How to get 'System.Web.Http, Version = 5.2.3.0?

I just created an MVC5 project and added some packages from nuget, but then when I compiled the project, I got this error. It seems that one of the packages really depends on system.web.http version 5.2.3.0, which I could not find anywhere. I am just wondering how to get the latest version of system.web.http?

 Error 2 Assembly 'System.Web.Http.WebHost, Version = 5.2.3.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35' uses 'System.Web.Http, Version = 5.2.3.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Http, Version = 5.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35' 
d: \ Backup 2014-12-25 \ Website-Projects \ www.ptsol.com.au \ packages \ Microsoft.AspNet.WebApi.WebHost.5.2.3 \ lib \ net45 \ System.Web.Http.WebHost.dll
+53
asp.net-mvc asp.net-mvc-5 nuget
Feb 19 '15 at 10:46
source share
6 answers

In the package manager console

Install-Package Microsoft.AspNet.WebApi.Core -version 5.2.3

+80
Feb 19 '15 at 11:21
source

One way to fix this is by changing the assembly redirection in the web.config file.

Change the following:

 <dependentAssembly> <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> </dependentAssembly> 

to

 <dependentAssembly> <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="4.0.0.0" /> </dependentAssembly> 

Thus, the oldVersion attribute should change from "...- 4.0.0.0" to "...- 5.2.3.0".

+16
Jul 07 '15 at 10:40
source

Installation Package Microsoft.AspNet.WebApi.Core -version 5.2.3

Then in the project Add Reference → Browse. Click the browse button and browse to C: \ Users \ UserName \ Documents \ Visual Studio 2015 \ Projects \ ProjectName \ packages \ Microsoft.AspNet.Mvc.5.2.3 \ lib \ net45 and add the required .dll file

+5
Mar 04 '16 at 9:26
source

I did the Install-Package Microsoft.AspNet.WebApi.Core -version 5.2.3 , but it still didn't work. Then he looked into the bin folder of my project and saw that he still had the old System.Web.Mvc file.

So, I manually copied the new file from the package to the bin folder. Then I started working again.

+4
Jul 04 '15 at 19:08
source

The packages you installed introduced the dependencies on dll version 5.2.3.0 as the Bracher user shown above. Microsoft.AspNet.WebApi.Cors is an example package. The path that I take is to update the proc of the MVC project:

 Install-Package Microsoft.AspNet.Mvc -Version 5.2.3 

https://www.nuget.org/packages/microsoft.aspnet.mvc

+4
Oct 14 '16 at 2:41
source

Uninstalling and reinstalling the NuGet package worked for me.

  • Remove any old link from the project.

Run this in the package manager console:

  1. UnInstall-Package Microsoft.AspNet.WebApi.Core -version 5.2.3
  2. Install-Package Microsoft.AspNet.WebApi.Core -version 5.2.3
+2
Jul 26 '16 at 12:21
source



All Articles