How to get 'System.Web.Http, Version=5.2.3.0?
Solution 1
In Package Manager Console
Install-Package Microsoft.AspNet.WebApi.Core -version 5.2.3
Solution 2
One way to fix it is by modifying the assembly redirect in the web.config file.
Modify 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>
So the oldVersion attribute should change from "...-4.0.0.0" to "...-5.2.3.0".
Solution 3
I did Install-Package Microsoft.AspNet.WebApi.Core -version 5.2.3
but it still did not work. Then looked in my project bin folder and saw that it still had the old System.Web.Mvc file.
So I manually copied the newer file from the package to the bin folder. Then I was up and running again.
Solution 4
The packages you installed introduced dependencies to version 5.2.3.0 dll's as user Bracher showed above. Microsoft.AspNet.WebApi.Cors is an example package. The path I take is to update the MVC project proir to any package installs:
Install-Package Microsoft.AspNet.Mvc -Version 5.2.3
https://www.nuget.org/packages/microsoft.aspnet.mvc
Solution 5
Install-Package Microsoft.AspNet.WebApi.Core -version 5.2.3
Then in the project Add Reference -> Browse. Push the browse button and go to the C:\Users\UserName\Documents\Visual Studio 2015\Projects\ProjectName\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45 and add the needed .dll file
John Hadikusumo
Updated on June 18, 2021Comments
-
John Hadikusumo almost 3 years
I just created an MVC5 project and added several packages from nuget, but then when I compiled the project, i got this error. It seems one of the packages really depends on system.web.http version 5.2.3.0, which i couldn't find anywhere. I just wonder 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 -
John Hadikusumo about 9 yearsI did but still giving me the same error <br/><pre>PM> install-package microsoft.aspnet.webapi.core -version 5.2.3 Attempting to resolve dependency 'Microsoft.AspNet.WebApi.Client (≥ 5.2.3)'. Attempting to resolve dependency 'Newtonsoft.Json (≥ 6.0.4)'. 'Microsoft.AspNet.WebApi.Core 5.2.3' already installed. www.ptsol.com.au already has a reference to 'Microsoft.AspNet.WebApi.Core 5.2.3'.</pre>
-
Rap about 9 years@JohnHadikusumo do this for all of your projects. It appears you have a dependent project with an older version.
-
AlfredBr about 8 yearsYes, this will work. Carefully read your Web.config and your packages.config both before and after you run this command and you'll see what changed.
-
George Lanetz over 7 yearsJust this one solved my problem. I've done so much and win-action was so simple.
-
Phon Soyang about 7 yearsSolved my problem.
-
jamiebarrow almost 7 yearsThis worked for me. We had the
bindingRedirect
setup as<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
but changed it to use4.0.0.0
. Still doesn't makes sense to me, because should be using the NuGet package DLL and not the GAC version, but hey, it worked... so thanks! -
user224567893 over 3 yearsI had to use
Install-Package Microsoft.AspNet.WebApi.Client -Version 5.2.7
instead (.Client instead of .Core). I had .Core 5.2.7 already, but I was still getting the error. nuget.org/packages/Microsoft.AspNet.WebApi.Client