问题描述
我得到这个异常:
System.Configuration.ConfigurationErrorsException:对于价值 compilerVersion在提供程序选项属性必须是4.0版或 以后如果要编译支持4.0或更高版本的.NET 框架。
我应该怎么做才能解决此问题?
What should I do to resolve this?
推荐答案
我也有类似的问题,只好告诉ASP.NET在配置上采用3.5编译如下修改的Web.config
。
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
.
我复制并粘贴从我的code以下。你必须为变化值=V3.5价值=V4.0。在编译器类型字符串也可能发生改变。
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>
在我的情况下,2.0编译器被用来取代3.5。我是在一个IIS 7的工作,ASP.NET网站项目。
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:
- System.CodeDom Namespace or
- compiler Element for compilers for compilation - ASP.NET Settings Schema.
这篇关于我该如何解决&QUOT; compilerVersion&QUOT; IIS错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!