26 July 2010

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 .

Hello all,
I had recently faced this issue. I have installed Visual Studio 2010 in my Window 7 operating system and was trying to run my application build on framework 3.5. After almost 3-4 hours search I found the following solutions.

Here we go...


Issue :
When trying to convert a Visual Studio 2008(framework 3.5) application to the Visual Studio 2010(framework 3.5 / 4.0), following error will raised by the visual studio IDE.
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.
Solution :
  • Go to C:\inetpub\wwwroot\Web.config
  • If it is not available, then please run your WebApplication or WebSite, albeit it has error.
  • Then it will display a yellow page error
  • Consider the path of the web.config file it shows in the error page.(see the image below).

  • Change the following stuff in the web.config
  • Remove the targetframework version from line no 20
  • Remove the pages tag from the web.config also
  • Rebuild your application and You have done it :))
Hope it will be helpful to someone.

2 comments:

  1. I came to my epiphany regarding this problem while reading this article. As soon as you mentioned "Consider the path..." I looked and saw that there was no path on my error page.

    I simply renamed the web.config file to web.config.backup and the page loaded without any problems.

    Of course I did still need to change the application pool for the website in ISS to use Asp.Net 4.0 (Integrated).

    I was so worried I would have to start from scratch on my website, thanks for the inspiration it took to fix it ^^

    ReplyDelete
  2. Thanks loganyoung. Glad to know that it is useful to you.

    ReplyDelete