I'm getting the following error when I Rebuild my project.
Assembly 'System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' which has a higher version than referenced assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' D:\Development\MyProject\bin\System.Web.Http.dll
I have already uninstalled and installed the latest version of Newtonsoft.Json (9.0.1) using Manage NuGet Packages in VS 2013. Why is it still referencing version 6.0.0.0 (or is it 4.5.0.0)?
My web.config shows the following:
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
What else should I do to resolve this? Thanks.
This error indicates that there is a version mismatch between what is referenced by the assembly (<Y.Y.Y.Y>) and what the project is pointed towards (<Z.Z.Z.Z>). To correct this, you need to re-add the correct reference in Solution Explorer. Confirm that the DLL version <Y.Y.Y.Y> is present on your computer.
Licensing. Json.NET is open source under the MIT license and is free for commercial use.
I encountered similar problems with newtonsoft.json reference after installing the nuget package Microsoft.AspNet.WebApi.Owin in combination with Microsoft.Owin.Security.OAuth package. I resolved the problem by running the following commands in the nuget package manager
First, uninstall the newtonsoft.json
uninstall-package Newtonsoft.Json -Force
Then, install the latest newtonsoft.json
install-package Newtonsoft.Json
And finally, update the owin OAuth which seems to be referencing to the old newtonsoft.json version
update-package Microsoft.Owin.Security.OAuth
After this, build the project and it should compile..At least my did :)
I managed to resolve this by going into web.config and changing this:
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" />
</dependentAssembly>
to this:
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
I'm not sure why the "newVersion" should be 9.0.0.0 when my Newtonsoft.Json version is 9.0.1, but it didn't compile with the latter.
Interestingly, when I later entered the following in the Package Manager Console:
Update-Package Newtonsoft.Json -Version 9.0.1
I could change the "oldVersion" and "newVersion" to anything and it had no effect on the compilation.
Many thanks to Rajput, Marcus H and Vivek Nuna for your help.
I don't know if you still need this or not. After updating Newton.Json in my project, your kind of error happens. And I found this thread and follow all answer instruction but no luck. But when I remove Newton.Json from references, then add my newer version of Newton.Json.dll to references, it works!
remove reference
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With