解决Newtonsoft.Json版本冲突问题

在配置文件中添加以下代码,App.config或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-10.0.0.0" newVersion="10.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
复制代码

oldVersion从什么版本到什么版本都强制使用newVersion的版本。

本例子说明从0版本到10版本,都强制使用10版本。

放上Newtonsoft.Json的版本下载地址:https://github.com/JamesNK/Newtonsoft.Json/releases

下载之后里面包括了.NET各版本的DLL文件,选择合适你工程的版本就行了。

posted on 2020-06-07 20:41  梦一尘  阅读(737)  评论(0编辑  收藏  举报