santosh kumar patro
santosh kumar patro

Reputation: 8231

Found conflicts between different versions of "Newtonsoft.Json" that could not be resolved

After upgrading VS2019 Enterprise edition to latest version: 16.9.4 , when I tried to build a project with Target Framework: NET Framework 4.7.2 , I am getting the below errors :

Found conflicts between different versions of "Newtonsoft.Json" that could not be resolved.
7>c:\program files (x86)\microsoft visual studio\2019\enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: There was a conflict between "Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" and "Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed".
7>c:\program files (x86)\microsoft visual studio\2019\enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277:     "Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" was chosen because it was primary and "Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" was not.
7>c:\program files (x86)\microsoft visual studio\2019\enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277:     References which depend on "Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" [<Path to the project>\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll].
7>c:\program files (x86)\microsoft visual studio\2019\enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277:         <Path to the project>\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll
7>c:\program files (x86)\microsoft visual studio\2019\enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277:           Project file item includes which caused reference "<Path to the project>\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll".
7>c:\program files (x86)\microsoft visual studio\2019\enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277:             Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL

Similarly for System.Net.Http.Formatting , System.Web.Http

Can anyone help me here by providing their guidance in fixing this issue

Upvotes: 1

Views: 3327

Answers (2)

logic101
logic101

Reputation: 1

I used the NuGet manager and installed the latest version of Newtonsoft.Json. This fixed the issue for me.

Upvotes: 0

BTSoft
BTSoft

Reputation: 169

Unfortunately things like this are a bit of a pain to resolve. If you open the Error List window (View --> Error List) you'll get a bit more detail. There should be a warning in the Error List with the dependencies causing the conflict. It's not intuitive what's causing the problem but you can figure it out if you spend the time reading through the entire warning. Essentially it boils down to getting packages to versions where all the dependencies are consistent.

Upvotes: 0

Related Questions