解决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文件,选择合适你工程的版本就行了。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM