“Newtonsoft.Json ......”在这两个“混合\ Newtonsoft.Json.dll'和'解决方案\包存在\ ... \在这、解决方案、存在、两个

2023-09-04 02:02:06 作者:微笑打败一切。

我不能够建立在Visual Studio 2013的解决方案。

这刚刚发生后,我更新了我的JSON.NET包6.0.1。在此之前,它的工作就像一个魅力。

任何想法?

PS:这也可能是一些关于OWIN。它引用JSON.NET过我想,也许动态?

展开误差的

 错误11Newtonsoft.Json.Linq.JObject存在于两个类型
C:\ Program Files文件(x86)的\微软的Visual Studio 12.0 \混合\ Newtonsoft.Json.dll和
'c:\Users\Me\Desktop\Solutions\[Project]\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll'
C:\用户\我\桌面\解决方案\ [项目] \ TrendPin \ App_Start \ Startup.Auth.cs 48 21 [项目]
 

我有这个在我的web.config

 < dependentAssembly>
    < assemblyIdentity名=Newtonsoft.Json公钥=30ad4fe6b2a6aeed文化=中性/>
    < bindingRedirect oldVersion =0.0.0.0-6.0.0.0NEWVERSION =6.0.0.0/>
< / dependentAssembly>
 
C JSON的序列化和反序列化

我有这个在我的.csproj

 <参考包括=Newtonsoft.Json,版本= 6.0.0.0,文化=中性公钥= 30ad4fe6b2a6aeed,的ProcessorArchitecture = MSIL>
  < SpecificVersion>假< / SpecificVersion>
  < HintPath> .. \包装\ Newtonsoft.Json.6.0.1 \ lib目录\ net45 \ Newtonsoft.Json.dll< / HintPath>
< /参考>
 

生成输出

  1> ------生成开始:项目:[项目] .Backend,配置:调试任何CPU ------
1>在packages.config列出的所有包都已经安装。
1> C:\ Program Files文件(x86)的\的MSBuild \ 12.0 \ BIN \ Microsoft.Common.CurrentVersion.targets(1635,5):警告MSB3277:不同版本的同一依赖程序集而无法得到解决之间找到冲突。这些参考冲突列在生成日志时,日志级别设置为详细。
1> [项目] .Backend  - > C:\用户\我\桌面\解决方案\ [项目] \ [项目] .Backend \斌\调试\ [项目] .Backend.dll
2  - ; ------生成开始:项目:[项目]。数据,配置:调试任何CPU ------
2  - ;在packages.config列出的所有包都已经安装。
2  - ; [项目]。数据 - > C:\用户\我\桌面\解决方案\ [项目] \ [项目]。数据\斌\调试\ [项目] .Data.dll
3> ------生成开始:项目:[项目],配置:调试任何CPU ------
3>在packages.config列出的所有包都已经安装。
3> C:\ Program Files文件(x86)的\的MSBuild \ 12.0 \ BIN \ Microsoft.Common.CurrentVersion.targets(1635,5):警告MSB3243:没有办法解决Newtonsoft.Json,版本= 6.0.0.0之间的冲突,文化=中性公钥= 30ad4fe6b2a6aeed和Newtonsoft.Json,版本= 4.5.0.0,文化=中性公钥= 30ad4fe6b2a6aeed。选择Newtonsoft.Json,版本= 6.0.0.0,文化=中性公钥= 30ad4fe6b2a6aeed随意。
3>考虑装配app.config将Newtonsoft.Json,文化=中性公钥= 30ad4fe6b2a6aeed从版本4.5.0.0[C:\ Program Files文件(x86)的\微软的Visual Studio 12.0 \混合\ Newtonsoft.Json.dll]到版本6.0.0.0 [C:\Users\Me\Desktop\Solutions\[Project]\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll]以解决冲突并消除警告。
3> C:\ Program Files文件(x86)的\的MSBuild \ 12.0 \ BIN \ Microsoft.Common.CurrentVersion.targets(1635,5):警告MSB3247:不同版本的同一依赖程序集之间发现冲突。在Visual Studio中,双击此警告(或选择它,preSS进入)来解决冲突;否则,添加以下绑定重定向到应用程序配置文件中的运行节点:< assemblyBinding的xmlns =瓮:架构 - 微软COM:asm.v1>< dependentAssembly>< assemblyIdentity名=Newtonsoft .Json文化=中性公钥=30ad4fe6b2a6aeed/>< bindingRedirect oldVersion =0.0.0.0-6.0.0.0NEWVERSION =6.0.0.0/>< / dependentAssembly>< / assemblyBinding>
3> C:\用户\我\桌面\解决方案\ [项目] \ [项目] \ App_Start \ Startup.Auth.cs(48,21,48,28):错误CS0433:类型Newtonsoft.Json.Linq。 JObject存在于两个C:\ Program Files文件(x86)的\微软的Visual Studio 12.0 \混合\ Newtonsoft.Json.dll和'c:\Users\Me\Desktop\Solutions\[Project]\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll'
4> ------跳过生成:项目:[项目] .Tests,配置:调试任何CPU ------
4>项目未选择构建此解决方案的配置
==========生成:2成功,1失败,0上升到最新,1跳过==========
 

解决方案

您可以反映出 owin ,看看它是寻找参考。如果查找特定的版本,你有麻烦,但如果没有,只是把你想要的版本到应用斌与 owin ,并希望签名相匹配。还记得,有GAC。所以,你有足够的空间进行试验

I'm not able to build the solution in Visual Studio 2013.

This just happened after I updated my JSON.NET package to 6.0.1. Before that, it was working like a charm.

Any ideas?

PS: It's probably something about OWIN. It references JSON.NET too I think, maybe dynamically?

Full error

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]

I have this in my 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>

I have this in my .csproj

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

Build Output

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

解决方案

You can reflect owin and see what is it looking for in references. If it looks for specific version, you in trouble but if not, just put the version you want into application bin together with owin and hope that the signatures match. Also remember, there is GAC. So, you have room for experimentation