首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >“Newtonsoft.Json……”同时存在于“Blend\Newtonsoft.Json.dll”和“解决方案\包”中\.

“Newtonsoft.Json……”同时存在于“Blend\Newtonsoft.Json.dll”和“解决方案\包”中\.
EN

Stack Overflow用户
提问于 2014-02-08 23:32:30
回答 3查看 22.4K关注 0票数 46

我无法在Visual 2013中构建解决方案。

这是在我将我的JSON.NET包更新为6.0.1之后发生的。在那之前,它就像一种魅力。

有什么想法吗?

PS:可能是关于我们自己的。它也引用了JSON.NET,我想,也许是动态的?

全误差

代码语言:javascript
运行
复制
Error   11  The type 'Newtonsoft.Json.Linq.JObject' exists in both 
'c:\Program Files (x86)\Microsoft Visual Studio 12.0\Blend\Newtonsoft.Json.dll' and
'c:\Users\Me\Desktop\Solutions\[Project]\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll'
C:\Users\Me\Desktop\Solutions\[Project]\TrendPin\App_Start\Startup.Auth.cs  48  21  [Project]

我的Web.Config里有这个

代码语言:javascript
运行
复制
<dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
    <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
</dependentAssembly>

我的.csproj里有这个

代码语言:javascript
运行
复制
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>

生成输出

代码语言:javascript
运行
复制
1>------ Build started: Project: [Project].Backend, Configuration: Debug Any CPU ------
1>  All packages listed in packages.config are already installed.
1>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.
1>  [Project].Backend -> C:\Users\Me\Desktop\Solutions\[Project]\[Project].Backend\bin\Debug\[Project].Backend.dll
2>------ Build started: Project: [Project].Data, Configuration: Debug Any CPU ------
2>  All packages listed in packages.config are already installed.
2>  [Project].Data -> C:\Users\Me\Desktop\Solutions\[Project]\[Project].Data\bin\Debug\[Project].Data.dll
3>------ Build started: Project: [Project], Configuration: Debug Any CPU ------
3>  All packages listed in packages.config are already installed.
3>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,5): warning MSB3243: No way to resolve conflict between "Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" and "Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed". Choosing "Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" arbitrarily.
3>  Consider app.config remapping of assembly "Newtonsoft.Json, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" from Version "4.5.0.0" [C:\Program Files (x86)\Microsoft Visual Studio 12.0\Blend\Newtonsoft.Json.dll] to Version "6.0.0.0" [C:\Users\Me\Desktop\Solutions\[Project]\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll] to solve conflict and get rid of warning.
3>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /><bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /></dependentAssembly></assemblyBinding>
3>C:\Users\Me\Desktop\Solutions\[Project]\[Project]\App_Start\Startup.Auth.cs(48,21,48,28): error CS0433: The type 'Newtonsoft.Json.Linq.JObject' exists in both 'c:\Program Files (x86)\Microsoft Visual Studio 12.0\Blend\Newtonsoft.Json.dll' and 'c:\Users\Me\Desktop\Solutions\[Project]\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll'
4>------ Skipped Build: Project: [Project].Tests, Configuration: Debug Any CPU ------
4>Project not selected to build for this solution configuration 
========== Build: 2 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2014-02-09 02:39:32

您可以反映owin,并在参考资料中查看它在寻找什么。如果它查找特定版本,您将遇到麻烦,但如果没有,只需将您想要的版本与owin一起放入应用程序bin,并希望签名匹配。还要记住,有GAC。所以,你有做实验的空间

票数 2
EN

Stack Overflow用户

发布于 2014-04-28 22:37:02

在csproj文件中,您会注意到Newtonsoft.Json有两个条目。删除下列条目:

代码语言:javascript
运行
复制
<Reference Include="Newtonsoft.Json">
    <HintPath>..\packages\Newtonsoft.Json.5.0.6\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
票数 108
EN

Stack Overflow用户

发布于 2018-09-17 16:27:49

在进行合并之后,我也遇到了几乎相同的问题。结果,合并在csproj文件中留下了两个对Newtonsoft.Json的引用。项目中有only,在NuGet包管理器中只有一个版本,但是csproj引用了Newtonsoft.Jason 5.0.6和5.0.8

我在notepad++中编辑了csproj并删除了这个令人反感的引用。解决了构建错误。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21653130

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档