I have a class library that uses System.Web.Mvc version 3 and System.Web.WebPages version 1. After installing Visual Studio 2012 (MVC version 4) I have a problem compiling this class library in Visual Studio 2010:
Assembly 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' c:\Program Files\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies\System.Web.Mvc.dll
In this project I do not want to use MVC 4 yet.
I opened the .csproj file in a text editor and found the following line:
I noticed the
HintPathdidn’t exists on my machine (Windows 7 32-bit), so apparently Visual Studio automatically takes the latest version (probably in the GAC). I removed System.Web.Mvc from the project references and added it again by browsing to the right path. The .csproj now looks like this:Also make sure the Version argument is set to 3.0.0.0.