無法加載文件或程序集'Newtonsoft.Json,Version = 4.5.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed'我收到了錯誤System.IO.FileLoadException:無法加載文件或程序集“Newtonsoft.Json,Version = 4.5.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed”或其依賴項之一。定位的程序集的清單定義與程序集引用不匹配。(HRESULT異常:0x80131040)我的CI構(gòu)建我試過的解決方案<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>它也沒用
3 回答

千萬里不及你
TA貢獻1784條經(jīng)驗 獲得超9個贊
對于遇到Newtonsoft.Json v4.5版本問題的每個人,請嘗試在web.config或app.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-6.0.0.0" newVersion="6.0.0.0"/> </dependentAssembly> </assemblyBinding></runtime>
重要信息:檢查configuration
配置文件的標記是否沒有命名空間屬性。否則,assemblyBinding
標簽將被忽略。

Helenr
TA貢獻1780條經(jīng)驗 獲得超4個贊
關(guān)鍵是在配置文件中引用正確的版本。
腳步;
1-查看項目引用屬性中Newtonsoft.Json.dll的版本,包文件夾中的版本是什么(例如我的版本是7.0.1,參考版本是7.0.0.0)
2-看看項目在異常中對你的期望(我的是6.0.0.0)
3-將依賴程序集添加到配置文件中,因為它應(yīng)該是..
<dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="7.0.0.0"/> </dependentAssembly>
- 3 回答
- 0 關(guān)注
- 3524 瀏覽
添加回答
舉報
0/150
提交
取消