dima dima - 11 months ago 83
C# Question

Version conflict with System.Web.Mvc

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 -projectname SportsStore.Domain
.. etc ..

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

Build "SportsStore.WebUI, Version=, Culture=neutral,
PublicKeyToken=null" use "System.Web.Mvc, Version=,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" of the later version
than the assembly "System.Web.Mvc, Version=, 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

Answer Source

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

SportsStore.WebUI, Version=, Culture=neutral, PublicKeyToken=null use System.Web.Mvc, Version=, 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=, Culture=neutral, PublicKeyToken=31bf3856ad364e35

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