我需要加载程序集Newtonsoft.Json的2个版本4.0.8.0和4.5.0.0。我当前的配置文件:
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.8.0" newVersion="4.0.8.0" />
</dependentAssembly>
但必须是:旧版4.0.8.0和新版4.5.0.0
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.8.0" newVersion="4.5.0.0" />
</dependentAssembly>
我从Package Console安装了Newtonsoft-最新版本-但它给我一个错误:
错误80无法加载文件或程序集'Newtonsoft.Json,版本= 4.5.0.0,区域性=中立,PublicKeyToken = 30ad4fe6b2a6aeed'或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。 (来自HRESULT的异常:0x80131040)**
我今天遇到了这个问题,我在此link中找到了解决方案。
将SignalR安装到我的项目后,我遇到了同样的问题。首先,我更新到了Newtonsoft.Json的最新版本,然后在我的web.config中添加了dependentAssembly。但是,即使在我的软件包中声明了6.0.8版本,我也必须在新版本中输入6.0.0.0的值。