Visual Studio的12.0 Blend和MVC 5 Web项目VS 2013之间Newtonsoft.Json.dll冲突 [英] Newtonsoft.Json.dll conflicts between Visual Studio 12.0 Blend and MVC 5 web project VS 2013

查看:324
本文介绍了Visual Studio的12.0 Blend和MVC 5 Web项目VS 2013之间Newtonsoft.Json.dll冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net mvc的5项目在VS2013,我一切的的NuGet包更新到最新的

I have a asp.net mvc 5 project in VS2013, I updated the nuget packages of everything to latest

然后我遇到这个错误

Error   2   The type 'Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver' exists in both 'c:\Program Files (x86)\Microsoft Visual Studio 12.0\Blend\Newtonsoft.Json.dll' and '{path to my project}\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll'

没有任何人碰到这个。

Does anyone else run into this.

推荐答案

我得到的错误,因为我有一个额外的

I got that error because I had an additional

<ItemGroup>
  <Reference Include="Newtonsoft.Json">
    <HintPath>..\packages\Newtonsoft.Json.5.0.6\lib\net45\Newtonsoft.Json.dll</HintPath>
  </Reference>
  <Reference Include="Owin">
    <HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
    <Private>True</Private>
  </Reference>
</ItemGroup>

在我Web.csproj直接低于已包含正确的引用到最新Newtonsoft.Json.dll通常引用。 VS中仅提及较新的组件被示出

in my Web.csproj directly below the usual references which already contained the correct reference to the latest Newtonsoft.Json.dll. In VS only the reference to the newer assembly was shown.

解决方案是:让我感动的有效Owin参考主要参考资料的ItemGroup并删除了过时的Newtonsoft.Json.dll引用(手动编辑的csproj文件)

Solution was: I moved the valid Owin reference to the main references ItemGroup and deleted the outdated Newtonsoft.Json.dll reference (manually editing the csproj file).

错误消息的原因:在我的机器旧Newtonsoft.Json.dll的HintPath不存在,为此被的MSBuild别处寻找并采取了混合版本

Cause of the error message: On my machine the HintPath of the old Newtonsoft.Json.dll did not exist, therefor MSBuild was looking elsewhere and took the Blend version.

(顺便说一句:要了解为什么以及在哪里的MSBuild正在寻找一定的组装使用的工具 - >选项 - >项目和解决方案 - >生成和运行 - > UND设置MSBuild项目生成输出的详细程度设置为详细并重建该项目。)

(BTW: To see why and where MSBuild is looking for a certain assembly use TOOLS -> Options -> Projects and Solutions -> Build and Run -> und set the "MSBuild project build output verbosity" setting to "Detailed" and rebuild the project.)

这篇关于Visual Studio的12.0 Blend和MVC 5 Web项目VS 2013之间Newtonsoft.Json.dll冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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