AspNet MVC4 项目更换更高版本Newtonsoft.Json
AspNet MVC4 项目生成时,自带4.5.0.0 Newtonsoft.Json。如果想更换更高版本的Newtonsoft.Json 如6.0.5.0. 项目自己引用时报:"未能加载文件或程序集“Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)"
解决方法1:
解决方案中引入Nuget,下载指定版本 Newtonsoft.Json,这种方法简单方便
解决方法2:
自己引用下载好的Newtonsoft.Json 版本,下面以6.0.5.0,在web.config中添加:
<runtime>
<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" />
</dependentAssembly>
</assemblyBinding>
</runtime>

浙公网安备 33010602011771号