< Return to Feed
Mike Matthes
06.27.2015

Sitecore 8.x MVC Version Conflicts

Problem

Sitecore 8 (Sitecore 8.0 rev. 141212.zip) ships with MVC version 5.1.0. If you create a new Visual Studio solution and download MVC from NuGet, you’ll have version 5.2.3 installed. Once you copy your dll into the Sitecore bin directory, you’ll get an error similar to:

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0433: The type 'System.Web.Mvc.WebViewPage<TModel>' exists in both 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\1c42830a\2cdb5c65\assembly\dl3\6c4a1aa3\215f74a8_01b1d001\System.Web.Mvc.DLL' and 'c:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.Mvc\v4.0_5.1.0.0__31bf3856ad364e35\System.Web.MVC.dll'

MVC version conflict error

Solution #1: Downgrade MVC Version

In order to fix this problem, you’ll need to either downgrade your MVC version to 5.1.0 or you can upgrade Sitecore to use MVC 5.2.3.

Downgrading MVC in your solution

Use the Package Manager Console in Visual Studio to change the version of MVC using the commands below.

opening package manager console


Package manager console example


First, check the versions of the installed packages

Get-Package

Then run this to uninstall MVC and all of it’s dependencies

uninstall-package Microsoft.AspNet.Mvc
uninstall-package Microsoft.AspNet.WebPages
uninstall-package Microsoft.AspNet.Razor

Then run this to install MVC 5.1.0

install-package Microsoft.AspNet.Mvc -version 5.1.0

Solution #2: Upgrade Sitecore MVC Version

Copy the latest version of System.Web.MVC to the Sitecore bin directory. Then update the web.config to tell .NET to use version 5.2.3 any time a dll is requesting MVC 5.1.0.


<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" xmlns="urn:schemas-microsoft-com:asm.v1" />
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" xmlns="urn:schemas-microsoft-com:asm.v1" />
</dependentAssembly>

Original web.config

upgrading Sitecore MVC version

Updated web.config

upgrading Sitecore MVC version

< Return to Feed