解決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