Loading ...

The value for the 'compilerVersion' attribute in the provider options must be 'v4.0' or later | CodeAsp.Net

The value for the 'compilerVersion' attribute in the provider options must be 'v4.0' or later

 /5
0 (0votes)

One of my colleagues was running the 4.0 framework web application and was getting this error:
The value for the 'compilerVersion' attribute in the provider options must be 'v4.0' or later if you are compiling for version 4.0 or later of the .NET Framework. To compile this Web application for version 3.5 or earlier of the .NET Framework, remove the 'targetFramework' attribute from the <compilation> element of the Web.config file. 

The issue I saw in his web config was compilers section. He was having this setting:

 
The change needed for 4.0 was to change the above code to

<system.codedom>
 <compilers>
  <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
    type="Microsoft.CSharp.CSharpCodeProvider,System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   <providerOption name="CompilerVersion" value="v4.0"/>
   <providerOption name="WarnAsError" value="false"/>
  </compiler>
 </compilers>
</system.codedom>


 This fixed the issue realted to compiler version error.

EDIT: 
One of my colleagues was facing similar kind of error but his issue was different. He was running 4.0 application as a child application under 3.5 version asp.net application(parent one) . The fix was to set the following property inheritInChildApplication to false in your parent site's config file like this:

<location path="." inheritInChildApplications="false">
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
        <providerOption name="CompilerVersion" value="v3.5" />
        <providerOption name="WarnAsError" value="false" />
      </compiler>
    </compilers>
  </system.codedom>


 

Comments (no comments yet)

Top Posts