Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ';Newtonsoft.Json…';存在于';Blend\Newtonsoft.Json.dll';和';解决方案\包\\_C#_Asp.net_.net_Visual Studio_Json.net - Fatal编程技术网

C# ';Newtonsoft.Json…';存在于';Blend\Newtonsoft.Json.dll';和';解决方案\包\\

C# ';Newtonsoft.Json…';存在于';Blend\Newtonsoft.Json.dll';和';解决方案\包\\,c#,asp.net,.net,visual-studio,json.net,C#,Asp.net,.net,Visual Studio,Json.net,我无法在Visual Studio 2013中构建解决方案 这是在我将JSON.NET包更新为6.0.1之后发生的。在那之前,它就像一个符咒 有什么想法吗 PS:可能是关于奥温的。我想它也引用了JSON.NET,可能是动态的 完全错误 我的Web.Config中有这个 <dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture

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

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

有什么想法吗

PS:可能是关于奥温的。我想它也引用了JSON.NET,可能是动态的

完全错误

我的Web.Config中有这个

<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>

我的电脑里有这个

<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>

假的
..\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll
构建输出

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 ==========
1>----构建已启动:项目:[Project]。后端,配置:调试任何CPU------
1> packages.config中列出的所有软件包都已安装。
1> C:\Program Files(x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,5):警告MSB3277:在同一依赖程序集的不同版本之间发现无法解决的冲突。当“日志详细性”设置为“详细”时,这些引用冲突将列在生成日志中。
1> [Project].Backend->C:\Users\Me\Desktop\Solutions\[Project]\[Project]。Backend\bin\Debug\[Project].Backend.dll
2> ----生成已启动:项目:[Project]。数据、配置:调试任何CPU------
2> packages.config中列出的所有软件包都已安装。
2> [Project].Data->C:\Users\Me\Desktop\Solutions\[Project]\[Project].Data\bin\Debug\[Project].Data.dll
3> ----构建已启动:项目:[Project],配置:调试任何CPU------
3> packages.config中列出的所有软件包都已安装。
3> C:\Program Files(x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,5):警告MSB3243:无法解决“Newtonsoft.Json,Version=6.0.0.0,Culture=neutral,PublicKeyToken=30ad4fe6b2a6eed”和“Newtonsoft.Json,Version=4.5.0.0,Culture=neutral,PublicKeyToken=30ad4fe6b2a6eed”之间的冲突。任意选择“Newtonsoft.Json,Version=6.0.0.0,Culture=neutral,PublicKeyToken=30ad4fe6b2a6eed”。
3)考虑从“4.5.0.0”版本[C:\Project文件(x86)\微软Visual Studio 12 \\NealtSoop.JSO.DLL]到“60.0.0”版本[c:\\\\\\\\\\\\\\\\\\Me\\Tab\\Frase\\Projk\\NethPosith.JSO.60.1\LIB \NET45 \NeNethSoop.JSO.DLL]的程序集“Newtonsoft.Json,Cule= NosialKeKeTe= 30AD4FE6B2A6AEED”的App.CONFIG重新映射。解决冲突,消除警告。
3> C:\Program Files(x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,5):警告MSB3247:在同一依赖程序集的不同版本之间发现冲突。在Visual Studio中,双击此警告(或选择它并按Enter键)以修复冲突;否则,将以下绑定重定向添加到应用程序配置文件中的“运行时”节点:
3> C:\Users\Me\Desktop\Solutions\[Project]\[Project]\App\u Start\Startup.Auth.cs(48,21,48,28):错误CS0433:C:\Program Files(x86)\Microsoft Visual Studio 12.0\Blend\Newtonsoft.Json.dll和C:\Users\Me\Desktop\Solutions\[Project]\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll中都存在类型“Newtonsoft”
4> ----跳过生成:项目:[Project]。测试、配置:调试任何CPU------
4> 未选择要为此解决方案配置生成的项目
======生成:2成功,1失败,0最新,1跳过==========

您可以在中反映
owin,并查看它在参考中寻找什么。如果它查找特定的版本,您会遇到麻烦,但如果没有,只需将您想要的版本与
owin
一起放入应用程序bin,并希望签名匹配即可。还要记住,还有GAC。因此,在csproj文件中有实验的空间,您会注意到Newtonsoft.Json有两个条目。删除以下条目:

<Reference Include="Newtonsoft.Json">
    <HintPath>..\packages\Newtonsoft.Json.5.0.6\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>

..\packages\Newtonsoft.Json.5.0.6\lib\net45\Newtonsoft.Json.dll

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


我用notepad++编辑了csproj,删除了有问题的引用,等等。它解决了构建错误

转到引用,删除旧的,并手动将新的添加到packages文件夹中的正确dll中。设置copy=true。你必须小心更新东西。看起来两个版本都被引用了。据我所知,您可能只需要删除旧引用中的一个。我移除了OWIN,它成功了。但我希望他们一起工作。(我还更新了问题)您可以在
中反映owin,并查看它在参考资料中寻找什么。如果它查找特定的版本,您会遇到麻烦,但如果没有,只需将您想要的版本与owin一起放入bin,并希望签名匹配。还要记住,还有GAC。所以,你有实验的空间,请写下来作为回答,我会接受的。你解释得很好,先生。这篇文章中被接受的答案为我解决了这个问题:我只有一个Newtonsoft.Json条目,不幸的是,这就是你建议删除的条目。那么你能把另一个参考条目粘贴到这里吗?谢谢。这可能不适用于VS扩展项目,看看这个。你太棒了!谢谢。当您的项目中甚至没有任何newtonsoft参考资料时,这种情况很常见。无论如何,VS似乎能够扫描程序集引用内部的依赖项,并尝试解析其中的一些依赖项。我们仍在努力寻找一个解决方案,让它不从(在我们的例子中)VisualStudioBlend文件夹复制newtonsoft dll。这是bullocks。现在它可以编译了,但是您会得到一个运行时错误,newtonsoft json版本无效…不,不应该,因为OP在proj文件中从来没有重复的条目注意!!!在投票否决之前,请阅读问题和下的评论
<Reference Include="Newtonsoft.Json">
    <HintPath>..\packages\Newtonsoft.Json.5.0.6\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>