C# – Version conflict with System.Web.Mvc

asp.net-mvcc

Now I read the book "ASP.NET MVC 5, Freeman", and I've created 3 projects:

  • SportsStore.Domain – for logic
  • SportsStore.UnitTests – for tests
  • SportsStore.WebUI – for views and controllers

Using NuGet command line I have install a lot of packages, like in the book:

Instal-Package Microsoft.Aspnet.Mvc -version 5.0.0.0 -projectname SportsStore.Domain
.. etc ..

But I think that I have install something wrong, because now I have error:

Build "SportsStore.WebUI, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null" use "System.Web.Mvc, Version=5.2.2.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" of the later version
than the assembly "System.Web.Mvc, Version=5.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35", to which reference is
made c:\Users\Дима\Documents\Visual Studio
2013\Projects\SportsStore\SportsStore.WebUI\bin\SportsStore.WebUI.dll SportsStore.UnitTests

Can't understand, how to solve it

Best Answer

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.