.net - NewtonSoft Json Assembly 版本问题

标签 .net json.net

我在尝试构建应用程序时遇到 NewtonSoft JSON 错误。

Error   4   Assembly 'System.Web.Http, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' which has a higher version than referenced assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'    

请帮我解决这个问题。

最佳答案

将您的项目更改为引用 JSON.NET 版本 6,因为您使用了另一个需要它的依赖项 ( System.Web.Http )。您不能在一个项目中使用同一程序集的两个版本。

您可以使用 NuGet 获取最新版本 (6) .在您的包管理器控制台中运行它:

PM> Install-Package Newtonsoft.Json

关于.net - NewtonSoft Json Assembly 版本问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26861588/

相关文章:

.net - 在 Windows Azure 上运行 .NET 1.1

c# - 如何在 C# 中遍历复杂的嵌套 Json 并将一组值附加到同一个 Json 中

c# - 使用 JSON.Net 保留继承的类类型

c# - 解析 Json 返回字符串还是字符串数组?

c# - Json.net反序列化null guid案例

.net - Newtonsoft.Json.DeserializeObject 抛出什么异常?

c# - 如何检测文件不是 ANSI-Latin1?

c# - 正则表达式 - 重用子表达式

.net - JSON 序列化程序在反序列化失败时创建一个空对象而不是 null

c# - WPF ListView 通过标题模板与扩展器分组?