Sitecore MVC Error

You have just started with Sitecore MVC and might have watched a very good series of videos by Martina Welander. If not you can get started with them at,

Sitecore MVC – Getting Started (Part 1)
Sitecore MVC — View Renderings, @Html.Sitecore(), and Custom Models (Part 2)

The point to write this post is after watching Part 1 video, I was still not able to run sitecore MVC on my machine. The obvious reason being, Martina’s video are for older version of Sitecore MVC whereas I was working on sitecore 7.2 and MVC 5.

The issue that I faced was,
Could not load file or assembly ‘System.Web.Mvc’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

sitecore mvc-1

Above error itself is self-explanatory and says something about mismatch of “System.Web.Mvc.dll” or one of its dependency.

Hence I checked the properties of in my website bin folder and there the catch was. Instead of version 5.1 it was 4.0 version of the System.Web.Mvc.dll

sitecore mvc-4

Also it is known that sitecore 7.2 supports MVC so I decided to install MVC 5 on my sitecore solution.

How to install MVC 5?

Different version of MVC can be installed using Package Manager Console available in Visual Studio IDE -> Tools -> Nuget Package Manager. I referred to Microsoft ASP.NET MVC 5.1.2 page for installation of MVC. This link also has information about other version of MVC and their installation.

sitecore mvc-2

Before installing MVC 5, your sitecore solution should be opened as it installs MVC specific to your project otherwise you will encounter the below error.

sitecore mvc-3

For installing MVC execute below command,
Install-Package Microsoft.AspNet.Mvc -Version 5.1.2

MVC 5 should now be installed. Do a web publish from you visual studio IDE and your sitecore site should now be up and running.

Finally to be sure check the properties of “System.Web.Mvc.dll” file it would have now been changed to 5.1.

sitecore mvc-5

More blogs on Sitecore MVC Errors

–          Preparing Sitecore 7.2 and MVC in Visual Studio 2013 by Martin Davis

Leave a Reply

Your email address will not be published. Required fields are marked *