1
votes

I am trying to follow an example in a book about MVC but i get an error when trying to build the project.

This is the error:

Error 2 Assembly 'SportsStore.WebUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' c:\Users\XXX\Documents\Visual Studio 2013\Projects\Sport\SportsStore.WebUI\bin\SportsStore.WebUI.dll SportsStore.UnitTests

It seems to me that I am running two different versions of the same assembly and I should probably update or "downdate" one of them? Can someone suggest which file and how to change it? Thank you

1
In your project, expand reference, right click System.Web.MVC and select Properties It probably reports the Version as 5.0.0.0, but the assembly requires Version 5.1.0.0. If so, you will need to upgrade the dll - user3559349
Thank you. In my solution I have three projects. Two of them ha version 5.0.0.0. How can I update these two versions of the assembly? With nuget maybe? - bugsy
Yes, using Manage Nuget Packages, and search online for MVC (I think the latest is 5.2.0.0) - user3559349
Thank you. This seemed to update two of the projects, unfortunatley it seemed to remove the references it was supposed to update in the third project. There is now yellow triangles next to a couple of references in one project: Warning 4 The referenced component 'System.Web.Mvc' could not be found. SportsStore.WebUI - bugsy
Not sure, haven't come across that before - user3559349

1 Answers

3
votes

The answer might be a little too late but hopefully it helps someone else. I had a similar issue and I resolved it by removing the lower version and running the command below inside of package manager console

install-package Microsoft.AspNet.Mvc -version 5.2.0