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.