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

走远了吗. 提交于 2019-11-27 20:23:15
Vin.X

because NuGet Package Manager (Version 2.8.60318.667) for VS 2012 does not support .NETStandard (Used for Latest Newtonsoft Json Parser Lib. https://github.com/NuGet/Home/issues/3131

I resolve this issue by installing older version of Newtonsoft Json:

PM> Install-Package Newtonsoft.Json -Version 9.0.1

More details on: https://github.com/NuGet/Home/issues/5162 .

Installing/restoring NuGet packages which target .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

  • Support for the netstandard and netstandardapp framework monikers

This version of NuGet comes with VS2015 Update 2

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

I had the same issue 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 as the work around.

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

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

Application that consumes your package will install Newtonsoft.Json version=10.0.3 along with your package as a dependency into your project.

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

    PM> Install-Package Newtonsoft.Json -Version 9.0.1

Try to install Newtonsoft MsgPack it will install Newtonsoft.json dll to your project.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!