ASP.NET MVC中需要两个不同版本的Newtonsoft.Json.dll [英] Two different versions of Newtonsoft.Json.dll needed in ASP.NET MVC
问题描述
我已经开发了一个MVC应用程序,该应用程序依赖于使用Newtonsoft.Json.dll v6.0.0.0的Connectwise SDK和使用Newtonsoft.Json.dll v7.0.0.0的Dropbox SDK.
I have developed a MVC application that has dependency on Connectwise SDK that uses Newtonsoft.Json.dll v6.0.0.0 and Dropbox SDK that uses Newtonsoft.Json.dll v7.0.0.0.
我需要确保我的项目在需要时使用适当的dll. 经过研究,我尝试了以下方法: -将2个dll分别放在/dlls/6.0.0.0/和/dlls/7.0.0.0子文件夹下. -项目参考中引用的6.0.0.0版dll -已添加到web.config
I need to ensure that my project uses the appropriate dll when needed. After researching, I tried the following: - Placed the 2 dlls under sub-folders /dlls/6.0.0.0/ and /dlls/7.0.0.0 resp. - Referenced version 6.0.0.0 dll in project References - Added to web.config
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed"
culture="neutral" />
<bindingredirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"></bindingredirect>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed"
culture="neutral" />
<bindingredirect oldVersion="7.0.0.0-7.1.0.0" newVersion="7.0.0.0"></bindingredirect>
<codeBase version="7.0.0.0" href="dlls/7.0.0.0/Newtonsoft.Json.dll" />
</dependentAssembly>
</assemblyBinding>
无法加载文件或程序集"Newtonsoft.Json,版本= 7.0.0.0,区域性=中立,PublicKeyToken = 30ad4fe6b2a6aeed"或其依赖项之一.找到的程序集的清单定义与程序集引用不匹配. (来自HRESULT的异常:0x80131040)
Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
我的href错误吗? dlls文件夹与MVC项目中的Content文件夹处于同一级别
Is my href incorrect ?? dlls folder is in the same level as Content folder in MVC project
谢谢, 加甘
推荐答案
我也遇到了同样的问题.我解决了使用此链接中提到的代码库方法的问题. https://devnet.kentico.com/articles/referencing-multiple-versions-of-same-same-a-in-单个应用程序
I had also hit the same issue. I solved using codebase methods mentioned in this link. https://devnet.kentico.com/articles/referencing-multiple-versions-of-the-same-assembly-in-a-single-application
这篇关于ASP.NET MVC中需要两个不同版本的Newtonsoft.Json.dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!