Could not load file or assembly 'System.Web.Http, Version=5.0.0.0

Hamid picture Hamid · Sep 11, 2014 · Viewed 28.3k times · Source

After installing Microsoft.Aspnet.Webapi.Webhost package to my web api project, I end up with the following exception:

Could not load file or assembly 'System.Web.Http, Version=5.0.0.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)

Answer

Hamid picture Hamid · Sep 12, 2014

I fixed this by reinstalling the NuGet package, which corrects broken dependencies. From the package manager, run Update-Package Microsoft.AspNet.WebApi -reinstall.