如何修复“compilerVersion"?IIS错误? [英] How do I fix the "compilerVersion" IIS error?

查看:25
本文介绍了如何修复“compilerVersion"?IIS错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到此异常:

<块引用>

System.Configuration.ConfigurationErrorsException: 的值提供程序选项中的 'compilerVersion' 属性必须是 'v4.0' 或稍后,如果您正在为 .NET 的 4.0 版或更高版本进行编译框架.

我应该怎么做才能解决这个问题?

解决方案

我遇到了类似的问题,不得不在配置中告诉ASP.NET使用3.5编译器如下修改Web.config.

我从我的代码中复制并粘贴了以下内容.您必须将 value="v3.5" 更改为 value="v4.0".编译器类型字符串也可能会改变.

<预><代码><配置><!-- ...其他配置的东西...--><system.codedom><编译器><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 language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4"><providerOption name="CompilerVersion" value="v3.5"/><providerOption name="OptionInfer" value="true"/><providerOption name="WarnAsError" value="false"/></编译器></编译器></system.codedom></配置>

就我而言,使用的是 2.0 编译器而不是 3.5.我在 IIS 7、ASP.NET 网站项目中工作.

您可能会从以下方面获得更多见解:

I'm getting this exception:

System.Configuration.ConfigurationErrorsException: 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.

What should I do to resolve this?

解决方案

I had a similar problem and had to tell ASP.NET in configuration to use the 3.5 compiler as follows by modifying Web.config.

I've copied and pasted the following from my code. You have to change value="v3.5" to value="v4.0". The compiler type strings might also change.

<configuration>

  <!--  ... other configuraiton stuff ... -->

  <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>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
        <providerOption name="CompilerVersion" value="v3.5"/>
        <providerOption name="OptionInfer" value="true"/>
        <providerOption name="WarnAsError" value="false"/>
      </compiler>
    </compilers>
  </system.codedom>

</configuration>

In my case the 2.0 compiler was being used instead of 3.5. I was working in an IIS 7, ASP.NET Website project.

You might glean additional insight from:

这篇关于如何修复“compilerVersion"?IIS错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆