“Newtonsoft.Json"已经为“Microsoft.CSharp"定义了一个依赖项

160

本文介绍了“Newtonsoft.Json"已经为“Microsoft.CSharp"定义了一个依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在安装 NewtonSoft.Json 以在 .NET 应用程序中解析 Json.当我使用 Visual Studio(VS) 2012 时,无法通过 NuGet 安装它.这是我得到的错误:

I'm installing NewtonSoft.Json for parsing Json in .NET application. When I'm using Visual Studio(VS) 2012, it can not be installed via NuGet. This is the error I have got:

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

我试图复制 DLL 并直接使用它,似乎在这个版本 (10.0.2) 中有些依赖项搞砸了.

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

经过几个小时的研究,终于发现是VS2012和Newtonsoft Json 10.0.2的兼容性问题.

After few hours research, finally I've found out it is the problem of the compatibility of VS2012 and Newtonsoft Json 10.0.2.

推荐答案

因为 VS 2012 的 NuGet 包管理器(版本 2.8.60318.667)不支持 .NETStandard(用于最新的 Newtonsoft Json Parser Lib.https://github.com/NuGet/Home/issues/3131

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

我通过安装旧版本的 Newtonsoft Json 解决了这个问题:

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

PM> Install-Package Newtonsoft.Json -Version 9.0.1

更多详情:https://github.com/NuGet/Home/issues/5162.

这篇关于“Newtonsoft.Json"已经为“Microsoft.CSharp"定义了一个依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

C# 中的多播委托奇怪行为?
Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)...
2023-11-11 C#/.NET开发问题
6

如何将代表存储在列表中
How to store delegates in a List(如何将代表存储在列表中)...
2023-11-11 C#/.NET开发问题
6

代表如何工作(在后台)?
How delegates work (in the background)?(代表如何工作(在后台)?)...
2023-11-11 C#/.NET开发问题
5

Delegate.CreateDelegate() 和泛型:错误绑定到目标方法
Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)...
2023-11-11 C#/.NET开发问题
14

函数委托与函数
Func Delegate vs Function(函数委托与函数)...
2023-11-11 C#/.NET开发问题
6

具有未知类型的 CreateDelegate
CreateDelegate with unknown types(具有未知类型的 CreateDelegate)...
2023-11-11 C#/.NET开发问题
5