Version conflict with System.Web.Mvc

I ran into this exact same problem myself and decided to update the versions of Microsoft.Aspnet.Mvc to the same version defined in the WebUI project. It did the trick for me and I thought I would share.

So in Package Manager Console, I ran:

Update-Package Microsoft.Aspnet.Mvc -version 5.2.3 -projectname SportsStore.Domain
Update-Package Microsoft.Aspnet.Mvc -version 5.2.3 -projectname SportsStore.UnitTests

Note: My version at the time of this writing was 5.2.3 . You state above that yours was 5.2.2, so use that instead.


The error message in the build explains the problem in clear terms if you know how to read it.

It starts by telling you that the WebUI project uses 5.2.2.0:

SportsStore.WebUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null use System.Web.Mvc, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

Then it tells you that one of your projects is referencing a different version:

later version than the assembly System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

Since you stated in your question that you installed 5.0.0.0 in your domain project, you will need to remove that version from the project, and install the correct version (in this case 5.2.2.0)


You have to update your Microsoft Asp.NET MVC version. To do that;

  1. Click Tool and select "NuGet Package Manager"
  2. Select "Manage NuGet Package Manager Console"
  3. Search for Microsoft Asp.NET MVC and update it.
  4. Restart Visual Studio

Tags:

C#

Asp.Net Mvc