Title: Could not load file or assembly 'Newtonsoft.Json, Version=217-749-8138, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' with google api
Tags: c#;json;dll;json.net
Question: In my project i used the library Newtonsoft.Json version 11.0.2, and i need use Google.Api and Google.Core, but when install this two library i receive the next error:
```
System.IO.FileLoadException: 'Could not load file or assembly
'Newtonsoft.Json, Version=217-749-8138, Culture=neutral,
PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)'
```
The error is because Google.Core use the version of newtonsoft.json 12.0.3 and in my project i have the version 11.0.2.
When made the build in output i can see the next error:
```
NU1605: Detected package downgrade: Newtonsoft.Json from 12.0.3 to
11.0.2. Reference the package directly from the project to select a different version.  MyProject -&gt; Google.Apis.Oauth2.v2 51.243.225.559 -&gt;
Google.Apis.Auth 1.48.0 -&gt; Google.Apis.Core 1.48.0 -&gt; Newtonsoft.Json
(&gt;= 12.0.3)  MyProject -&gt; Newtonsoft.Json (&gt;= 11.0.2)
```
How should to fix this error?

Comment: I try this, but, the web desn't work. 
I can solved this error make this, but i receive another error when loading web. My code it have incompatibility with new version.

Comment: thanks @Ralf and dogyear for their answers. The problem is I have a lot of code and i want to find another solution for not touch or touch the minimal as possible code.

Any idea for solved this? 

I see myself correcting a lot of code ): -_- ;)

Comment: @Ralf is correct.  You should change all of your references to 12.0.3 since that's what is needed to run those Google Nuget packages.  Since it's resulting in your code being incompatible with the new version you'll need to fix your code.  If your code can't work with the new version then your code can't work with the Google packages.  So you just gotta update and fix your code.  No way around that.

Comment: Do what the error message tells you to do. You should reference in all project the Newtonsoft.Json package you want to use or is at least needed (presumably at least 12.0.3). That will overide the dependencies of the other referenced packages in that projects.

Comment: There is no easy way. When using nuget packages you need to always have an eye on their dependencies. Json.Net is a typical candidate here. Many nuget packages have that as dependencies and then in different versions. If you just let it go a more or less random version (presumably a wrong one) of that will lastly end up in your output folder. You need to check the package dependencies. Find the version that all packages can live with and reference that one from your project.


Here is another answer: Can you try updating the package to the latest version in your project? Try remove all the references of the  Newtonsoft.Json (11.0.2) from your project and install the latest update from Nuget. Hope that works.


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 5, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2020:00:11/17/20', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<c#><json><dll><json.net>', 'Title': "Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' with google api", 'ViewCount': 2449, 'id': 64877146, 'user_AboutMe': None, 'user_AccountId': 18094858.0, 'user_DisplayName': 'Daviel Sánchez', 'user_Reputation': 21.0, 'user_Views': 5.0, 'user_id': 14326167.0}}