【发布时间】:2018-09-29 01:14:16
【问题描述】:
我开发了一个 MVC 应用程序,它依赖于使用 Newtonsoft.Json.dll v6.0.0.0 的 Connectwise SDK 和使用 Newtonsoft.Json.dll v7.0.0.0 的 Dropbox SDK。
我需要确保我的项目在需要时使用适当的 dll。 经过研究,我尝试了以下方法: - 将 2 个 dll 分别放在 /dlls/6.0.0.0/ 和 /dlls/7.0.0.0 子文件夹下。 - 项目参考中引用的版本 6.0.0.0 dll - 添加到 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, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。 (HRESULT 异常:0x80131040)
我的href不正确吗? dlls文件夹与MVC项目中的Content文件夹同级
谢谢, 加根
【问题讨论】:
-
是否存在不允许您使用 7.0 满足所有需求的重大更改或功能更改?
标签: c# model-view-controller dll json.net assembly-binding-redirect