如何解决两个JSON.net存在的冲突? [英] How to resolve this conflict of two JSON.net existing?

查看:515
本文介绍了如何解决两个JSON.net存在的冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在解决方案中的所有项目中都更新了json.net,并且在收到此错误后:

I updated json.net in all projects in my solution and after I get this error:

两者中都存在类型'Newtonsoft.Json.JsonConvert' '\ packages \ Newtonsoft.Json.6.0.1 \ lib \ net45 \ Newtonsoft.Json.dll'和 'c:\ Program Files(x86)\ Microsoft Visual Studio 12.0 \ Blend \ Newtonsoft.Json.dll

The type 'Newtonsoft.Json.JsonConvert' exists in both '\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll' and 'c:\Program Files (x86)\Microsoft Visual Studio 12.0\Blend\Newtonsoft.Json.dll

为什么要尝试从Blend文件夹中加载json.net,如何解决此问题?

Why is it trying to load json.net from the Blend folder and how do I get around this issue?

谢谢.

推荐答案

在我的情况下,问题是我的项目中有两个对两个不同版本的Newtonsoft.Json.dll的引用.通过查看解决方案"树视图中的引用,这种情况并不明显:您必须检查csproj文件.

In my case, the problem was that there were two references to two different versions of Newtonsoft.Json.dll in my project. This wasn't apparent by looking at the references in the Solution tree view: you have to examine the csproj file.

要解决此问题:

  1. 右键单击Visual Studio中的项目,然后选择卸载项目"
  2. 在MSBuild文件中搜索对Newtonsoft.Json的引用
  3. 删除旧版本库的引用
  4. 右键单击该项目并重新加载.

这篇关于如何解决两个JSON.net存在的冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆