Tuesday, June 14, 2011

Running Umbraco on .Net Framework 4.0


This post is about an unusual configuration issue that, many Umbraco developers face when they first try to upgrade their Umbraco installation to .Net Framework 4.0. It is unusual in a sense that over the last few framework releases there has been a norm that the web.config schemas were backward compatible and it was never required to update the configurations during an upgrade.

.Net Framework 4.0 has been launched with a new machine.config file, and off course it doesn't override the earlier machine.config in use by previous frameworks. The following changes have been done in the new machine.config:
  • ASP .NET Tag Sections
  • ASP .NET AJAX
  • ASP .NET Dynamic Data
  • ASP .NET Routing
  • ASP .NET Chart Control
 So, we will need to omit all the above mentioned items form our web.config, so that Umbraco starts working with .Net Framework 4.0.
  1. Set the web site's  Application Pool to ASP.NET v4.0.
  2. Remove/Comment the sectionGroup named "system.web.extensions" under configSections tag.
  3. Change the compilation tag and set the targetFramework attribute to 4.0 
    <compilation defaultLanguage="c#" debug="true" batch="false" targetFramework="4.0">
  4. Delete the whole assemblies section below that compilation tag.
  5. Remove/Comment the controls having "asp" tagPrefix, under system.web/pages/controls tag.
  6. Remove/Comment all handlers and modules specific to "ASPNETAJAX", under system.webServer and system.web tags.
  7. Most importantly, search for "Version=3.5.0.0" text in you web.config and replace it with "Version=4.0.0.0".
  8. Finally, make sure you have the "Microsoft.Scripting.ExtensionAttribute.dll" in Umbraco bin directory, i.e. most probably at "c:\inetpub\wwwroot\bin".
That's all folks, enjoy Umbraco development on .Net Framework 4.0.