Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NewtonSoft Json Assembly version issues

Tags:

.net

json.net

I am getting an error with NewtonSoft JSON when I try to build my application.

Error   4   Assembly 'System.Web.Http, Version=5.2.2.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'    

Please help me in resolving this.

like image 610
user3564183 Avatar asked Nov 11 '14 09:11

user3564183


People also ask

Is Newtonsoft JSON obsolete?

Yet Newtonsoft. Json was basically scrapped by Microsoft with the coming of . NET Core 3.0 in favor of its newer offering designed for better performance, System.

Is Newtonsoft JSON compatible with .NET core?

Text. Json library is included in the runtime for . NET Core 3.1 and later versions. For other target frameworks, install the System.

How many downloads does Newtonsoft JSON have?

Over 1 billion downloads and counting, Json.NET is the number one library on NuGet.


1 Answers

Change your project to reference to JSON.NET version 6 since you use another dependency (System.Web.Http) that needs it. You can't use two versions of the same assembly in one project.

You can get the latest version (6) using NuGet. Run this in your package manager console:

PM> Install-Package Newtonsoft.Json
like image 159
Patrick Hofman Avatar answered Nov 08 '22 21:11

Patrick Hofman