Introduction
Here, I am going to create a new blank MVC4 project in Microsoft Visual Studio 2010 and then I will add Umbraco 6.0.3 package to it. In this process, unfortunately, you may encounter a couple of bugs which have been highlighted in yellow.
Background
Umbraco is an open source ASP.NET CMS. More information regarding it can be found here.
Using the Code
- Create an empty MVC 4 project in Visual Studio.
- Add the NuGet Umbraco Cms Core Binaries package to manage various dependencies and references that Umbraco 6 requires. To do this, open Package Manager Console (From the Tools menu, select Library Package Manager and then click Package Manager Console) and type Install-Package UmbracoCms.Core -Version 6.0.3.


- Download and copy all the files from the Umbraco installation ZIP archive directly into your project in Visual Studio except the App_Code and Bin folders – you won’t need the binaries as they are managed by NuGet and the App_Code folder is not used in a web application project.
- Change the default mode for Umbraco from web forms to MVC in the
defaultRenderingEngine
setting in the Umbraco configuration file UmbracoSettings.config as shown below:
<templates>
<useAspNetMasterPages>true</useAspNetMasterPages>
<defaultRenderingEngine>Mvc</defaultRenderingEngine>
</templates>
Unfortunately, if you run the application now, you may encounter the error ApplicationException: The current httpContext can only be set once during a request.
The solution is to do the following in the web.config file.
Copy the httpModules
tag and keep it handy for later use.
Add <add name="umbracoRequestModule" type="umbraco.presentation.requestModule" />
Add <add name="umbracoBaseRequestModule" type="umbraco.presentation.umbracobase.requestModule" />
Comment out <!--<add name=" UmbracoModule" type="Umbraco.Web.UmbracoModule,umbraco" />-->
<httpModules>
-->
<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule,
UrlRewritingNet.UrlRewriter" />
<add name="umbracoRequestModule" type="umbraco.presentation.requestModule" />
-->
-->
<add name="umbracoBaseRequestModule" type="umbraco.presentation.umbracobase.requestModule" />
-->
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule,
System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
-->
<add name="ClientDependencyModule" type="ClientDependency.Core.Module.ClientDependencyModule,
ClientDependency.Core" />
</httpModules>
Now the application will debug successfully and the Umbraco installation wizard will start to configure Admin and DataBase details.
The five steps of the wizard are displayed below:






Points of Interest
The following articles were consulted to compose this blog. For more details of any particular domain, click on the appropriate link below: