Reputation: 2837
I am currently working on a Web API project where I have a single simple controller that works correctly. I created a Unit Test project to test my API's controller. The project references System.Net.Http (4.0.0.0)
and System.Web
assemblies as well as Microsoft ASP.NET Web API 2.2 Web Host
NuGet package and all its sub-packages. When I run my first TestMethod
it fails and throws an exception saying:
Could not load file or assembly 'System.Web.Http, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
I tried a lot of things but nothing seemed to solve my issue and there isn't a System.Net.Http
with version 5.2.2.0 in References -> Assemblies
. I am currently using Visual Studio Community Edition 2013. Thanks!
Upvotes: 2
Views: 3639
Reputation: 446
Try reinstalling the NuGet package Microsoft ASP.NET Web API 2.2 Core Libraries
for that project? System.Web.Http 5.2.2.0 is contained in that package. You should be able to see a reference for System.Web.Http under your project references for version 5.2.2.0 or greater if that NuGet package was installed correctly.
Upvotes: 3