【发布时间】:2015-12-23 23:55:55
【问题描述】:
我正面临以下错误
无法加载文件或程序集 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' 或其之一 依赖关系。定位程序集的清单定义不 匹配程序集引用。 (HRESULT 异常:0x80131040)
我可以在 Web.config 中看到以下内容
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
所以我改成
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.1.0" />
</dependentAssembly>
在packeges.config中我可以看到下面的条目
但我仍然面临同样的问题。请帮忙
【问题讨论】:
-
造成这种情况的原因可能有很多。首先:检查输出文件夹中的程序集,并检查文件版本和强名称是否符合您的预期。我怀疑强名称版本是 7.0.0.0,所以将 bindingRedirect 改回那个版本(强名称和文件版本可能不同 - 它适用于 Newtonsoft.Json 6.*)
标签: c# asp.net asp.net-mvc json.net nuget