首页 > Web开发 > 详细

解决未能加载文件或程序集“Newtonsoft.Json ...."或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)

时间:2016-11-28 15:08:30      阅读:1805      评论:0      收藏:0      [点我收藏+]

今天遇到了一个比较坑的问题,琢磨了好久。。。

因为需要引用一个第三方的类库,三方的类库引用的是Newtonsoft.Json.dll 版本7.0.0而我的项目中引用的是Newtonsoft.Json.dll 版本4.5.0,这样两个引用造成了冲突。所有的引用都OK,编译时提示“ Newtonsoft.Json.Linq”未引用,可是这明明已经引用了。尝试使用nuget更新,更新到最新版9.0.0,更新成功后可以一成功编译,但是访问时又出现这个样的问题。

技术分享

最终解决方法,修改web.config,这里只是告诉大家格式,只用添加完整的dependentAssembly内容即可。

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

 

解决未能加载文件或程序集“Newtonsoft.Json ...."或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)

原文:http://www.cnblogs.com/loyung/p/6109092.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!