Newtonsoft.Json版本冲突时参考解决方案

运行报错:未能加载文件或程序集“Newtonsoft.Json, Version=10.0.0.0,

 

 

如果同一项目中不同第三方类库分别使用了不同版本的Newtonsoft.Json的情况下,可以在配置文件中添加以下节点,将0.0.0.0-9.0.0.0此区间的Newtonsoft.Json使用全部强制指向到8.0.0.0版本。

此方案适用于高版本的Newtonsoft.Json向下兼容!

 

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
        <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="8.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
 
 
转自https://www.cnblogs.com/lijunhao/p/5440001.html
posted @ 2018-11-20 15:01  纵一苇之所如-  阅读(888)  评论(0编辑  收藏  举报