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

Created on 4 May 2017  路  12Comments  路  Source: NuGet/Home

Users of Json.NET are reporting this error message:

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

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe):

Sounds like the problem is in VS2012

Detailed repro steps so we can see the same problem

  1. Install Newtonsoft.Json 10.0.2 in VS2012

  2. The error!

Issue where users are reporting the problem: https://github.com/JamesNK/Newtonsoft.Json/issues/1265

Duplicate

Most helpful comment

exactly same issue, it worked installing older Newtonsoft.Json version trhough PM (Package Manager Console)
PM> Install-Package Newtonsoft.Json -Version 9.0.1

All 12 comments

VS 2012 does not support netstandard.

The user experience here could be improved by setting the minimum client version required for the package to 2.12. This is the lowest version of NuGet that supports netstandard.

If NuGet in VS 2012 doesn't support netstandard why is it choosing to install that target instead of net45 or PCL that it does support?

Also how does minimum client version work with csproj + pack?

@JamesNK just specify MinClientVersion as a property in your csproj file you are packing. https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Build.Tasks.Pack.Library/Pack.targets#L170

If NuGet in VS 2012 doesn't support netstandard why is it choosing to install that target instead of net45 or PCL that it does support?

The older client throws the error you are seeing when it reads the nuspec. It encounters two unsupported framework dependency groups (netstandard1.0 and netstandard1.3) and fails when merging the dependencies together. It doesn't get as far as selecting assets from the package unfortunately.

I see! Not ideal but we can't change the past.

Ok, I'll include a min version. What value do you recommend?

The system packages use 2.12, I would stick to that.

Example in nuspec:

<metadata minClientVersion="2.12">

So instead of fixing this issue, you actually advise rendering nuget packages unusable for those still stuck with VS 2012?

Note that this issue is a duplicate of #3131.

@drieseng are you able to repro this with NuGet 4.1.0?

@emgarten: The latest NuGet Package Manager available for VS 2012 is 2.8. The download site for NuGet no longer lists VS 2012, and there's definitely not a 4.1.0 for VS 2012.

exactly same issue, it worked installing older Newtonsoft.Json version trhough PM (Package Manager Console)
PM> Install-Package Newtonsoft.Json -Version 9.0.1

The root cause of this issue is https://github.com/NuGet/Home/issues/3131

Was this page helpful?
0 / 5 - 0 ratings