Multi project solution "Could not load file or assembly 'System.Web.Mvc, Version=5.2.4.0," not giving a project name

3

I have a Solution with many different project types in (Class File, ASP.net MVC 5, ASP.net Core 2.1). When I try and build the Solution I get this error:

Could not load file or assembly 'System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

However, there is no associated project name. Project, File, Line are all empty.

How can I find out which project is causing the error? How can I trouble shoot this?

I can find various Google results for the particular error - but if the compiler doesn't even tell me which project is at fault - how can I begin to fix it?

Thanks.

Update: What are the valid reasons for the compiler not supplying the name of the project at fault, if any?

c#
visual-studio
visual-studio-2017
asked on Stack Overflow Aug 8, 2018 by niico • edited Aug 8, 2018 by niico

1 Answer

1

System.Web.Mvc is a namespace used by MVC 5 so the error is likely occurring in your MVC 5 project (https://docs.microsoft.com/en-us/previous-versions/aspnet/web-frameworks/dd492706(v=vs.118)).

One quick fix would be to ensure that the package is in your project. If you find that it's missing, generate a new project and copy over the binary from the bin directory of that project to your project.

Another thing you can try is deleting the reference to the package and adding it back. This should resolve any dependency issues regarding a version mismatch or file reference error.

answered on Stack Overflow Aug 8, 2018 by user1477388

User contributions licensed under CC BY-SA 3.0