一是之一,它不僅是重複的。以下問題的答案都不適用於我。無法加載文件或程序集「Newtonsoft.Json」或一個依賴
http://goo.gl/tS40cn
http://goo.gl/pH6v2T
我剛剛更新使用NuGet包管理器中所有我的包,我開始收到此錯誤。
無法加載文件或程序集「Newtonsoft.Json,版本= 6.0.0.0,文化=中性公鑰= 30ad4fe6b2a6aeed」或它的一個依賴。定位的程序集清單定義與程序集引用不匹配。 (從HRESULT異常:0x80131040)
我的包配置有:
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
Web.config中包括這一段代碼:從參考
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" />
</dependentAssembly>
屬性Newtonsoft.Json
據來自類似的問題的答案,我已經試過如下:
- 重新安裝使用
Update-Package –reinstall Newtonsoft.Json
- 去除
Web.config
dependentAssembly
配置包Newtonsoft.Json
- 在
dependentAssembly
更改newVersion
到6.0.0.0
和7.0.0.0
。這樣做產生了新的錯誤。 - 也試過
Get-Project -All | Add-BindingRedirect
。它改變了newVersion
向Newtonsoft.Json
4.5.0.0
。但問題仍未解決。
請幫我解決這個。
你有沒有建立之前乾淨生成文件夾的內容?你的目標是與引用的dll相同的框架版本嗎? – ilansch