We recently upgraded our Web application to .NET 4.0 and it seemed to be a straight forward task. Just open the solution in Visual Studio 2010 and follow the instructions in the wizard and I am done. (Detailed steps of Upgrade can be found here)
That’s most of the times true. However there could be some surprises to watch out for.
You may encounter an error for system.web.extensions at compile time or runtime.
Unrecognized configuration section system.web.extensions.
This error indicates that the system.web.extensions section is not defined anywhere in your web.config or machine.config. However if you check the machine.config in <<Windows Directory>>\Microsoft.NET\Framework\v4.0.30319\Config\machine.config you can see this section declared.
Following things are to be taken care for your web app to use the machine config from v4.0 and not earlier versions.
<Target Name=”AfterBuild” Condition=”’$(MvcBuildViews)’==’true’”>
<AspNetCompiler VirtualPath=”temp” ToolPath=”$(WINDIR)\Microsoft.NET\Framework\v2.0.50727” PhysicalPath=”$(ProjectDir)\..\$(ProjectName)” />
<AspNetCompiler VirtualPath=”temp” ToolPath=”$(WINDIR)\Microsoft.NET\Framework\v2.0.50727” PhysicalPath=”$(OutDir)\_PublishedWebsites\$(ProjectName)” />