未能加載文件或程序集“Newtonsoft.Json, Version=4.5.0.0


錯誤描述:

錯誤原因:

因為引用出了問題,在你的程序集里面找不到的Newtonsoft.Json,所以它就拿從系統盤里面預裝的舊版的來用,結果就報版本錯誤了.

解決方案:

web.config  的 configuration節點下面注明

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

就要求用6.*版本的了。

你可以刪除bin文件夾里面的Newtonsoft.Json,重新用nuget 引用一遍(重寫nuget自動解決版本問題)。

 

我就只說到這里了,具體常見錯誤有三種情況

第一,引用不存在vs自動找到舊版的。
第二,web.config配置的版本號跟實際想要版本號不對。
第三,bin文件夾里面的根本就是舊版的。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM