'compilerVersion' attribute in the provider options must be 'v4.0' or later
Asked Answered
H

4

12

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 element of the Web.config file.

It was working on our dev system, and we are now deploying to QA using an xcopy type deploy.

We don't have a "compilerVersion" anywhere in the web.config, and the targetFramework is set to "4.0". We have done an IISReset.

<system.web>

        <compilation debug="true" targetFramework="4.0">
        <assemblies>
            <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        </assemblies>
    </compilation>

UPDATE 2: when we removed the entire section, we got past the error. So my question is, what is wrong with leaving in this section if we are on .NET 4.0?

We just did a full xcopy of exactly what was in Test to QA, and in QA it gets the error and DEV doesn't. So the software and configs are identical. Why would it work on one server and not another? IIS options seem to be identical.

Hallam answered 4/4, 2011 at 23:30 Comment(1)
Possible solution #3314969Frilling
W
8

taken from: http://www.asp.net/whitepapers/aspnet4/breaking-changes#0.1__Toc256770150

you should go to your server root web.config and include the whole <system.codedom>...</system.codedom> tag content into a <location path="" inheritInChildApplications="false">...</location> tag

Wheels answered 5/8, 2013 at 11:4 Comment(0)
M
5

Possible solution here - asp.net/whitepapers/aspnet4/breaking-changes#0.1__Toc256770150

Materials answered 4/4, 2011 at 23:45 Comment(5)
Thanks, but we do want 4.0, and IIS ASP.NET version is set to 4.0.30319.Hallam
@Neal. That article is for 4.0. Look at the answer. The title is misleading. Somewhere in your web.config hierarchy (application level, site level etc) there is a <compiler>/<compiler> tag pointing to .NET 3.5 which is confusing the web server.Materials
the difference is they have <add assembly=System.Core, Version=3.5.0.0 and I have 4.0.0.0... When we comment it out, we are now having success, but a while ago we were getting "Exception of type 'System.Web.HttpUnhandledException' was thrown." We are still trying to chase down what is different. My main point is that I should have the exact same error on my TEST environment. We don't want to hit errors like this when we go to QA (and the configs are the same).Hallam
the link above is not working anymore. for those who are in trouble, check this MS article: asp.net/whitepapers/aspnet4/breaking-changes#0.1__Toc256770150Wheels
@Materials nailed it. Our main site had the <compiler> tag specifying v=2.0 and a providerOption v=3.5. I removed them both, and our main site still works, along with the apps in that site that are targetFramework 4.0 and above (now we can leave that compilation tag in the web.config and compile the correct version)Fab
G
1

After fighting with this for a while, I ended up creating a new IIS site using a different port and adding my ASP.Net 3.5 application to the new site and it is working perfectly.

Geriatrician answered 18/9, 2014 at 20:5 Comment(1)
Awesome, Saves my life almost wasting 4h.Diameter
T
1

I got the same error and found out that my v4.0 website was hosted under the default website that was v2.0. If you've such setup then you need to remove the following line from your web.config:

<compilation defaultLanguage="c#" debug="true" targetFramework="4.0"/>

I hope that helps.

Theta answered 8/7, 2015 at 16:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.