"Newtonsoft.Json" already has a dependency defined for "Microsoft.CSharp",

I am installing NewtonSoft.Json to parse Json in a .Net application. When I use VS 2012, it cannot be installed through NuGet. This is the error I received:

'Newtonsoft.Json' already has a dependency defined for 'Microsoft.CSharp' 

I tried to copy the DLL and just use it, it looks like some dependencies messed up in this version (10.0.2).

After several hours of research, I finally discovered that this is a compatibility issue between VS2012 and Newtonsoft Json 10.0.2.

+39
Jun 13 '17 at 21:50
source share
6 answers

because the NuGet package manager (version 2.8.60318.667) for VS 2012 does not support .NETStandard (used for the latest versions of Newtonoft Json Parser, https://github.com/NuGet/Home/issues/3131

I solved this problem by installing an older version of Newtonsoft Json:

 PM> Install-Package Newtonsoft.Json -Version 9.0.1 

More information at: https://github.com/NuGet/Home/issues/5162 .

+60
Jun 13 '17 at 21:54 on
source share

Installing / repairing NuGet packages that are configured with the .NET standard requires NuGet.exe version 3.4+.

From the release notes for 3.4: https://docs.microsoft.com/en-us/nuget/release-notes/nuget-3.4

New features

  • Netstandard and netstandardapp proxy support

This version of NuGet comes with VS2015 Update 2

NuGet 3.4 was released on March 30, 2016 as part of Visual Studio 2015 Update 2 and Visual Studio 15 Preview Release

+12
Nov 07 '17 at 16:06
source share

I had the same problem using VS2015 and creating a NuGet package with dependency on Newtonsoft.Json version = 10.0.3. I used the approach suggested by Vin.X in his answer, how about work.

After installing Newtonsoft.Json version = 9.0.1 in your project, add the following description to your .nuspec file.

 <dependencies> <dependency id="Newtonsoft.Json" version="10.0.3" /> </dependencies> 

An application that consumes your package will install Newtonsoft.Json = 10.0.3 along with your package as a dependency on your project.

+4
Jul 12 '17 at 18:31 on
source share

Try removing the existing version of the package from the solution package directory, and then try the following command. It worked for me.

  PM> Install-Package Newtonsoft.Json -Version 9.0.1 
0
May 22 '19 at 5:27
source share

just using Try {} catch () {}

  try{ int offset = 0; while (true) { Telegram.Bot.Types.Update[] updates = bot.GetUpdates(offset).Result; } } catch (Exception ef) { Debug.WriteLine("Error"); } 
0
Jun 08 '19 at 15:30
source share

Try installing Newtonsoft MsgPack, it will install the Newtonsoft.json DLL into your project.

-one
Nov 03 '17 at 4:16
source share



All Articles