2017-08-15 114 views
0

在Visual Studio 2015中,我在同一解決方案中有Project A(Web Api應用程序)和Project B(MVC應用程序)。Visual Studio調試dll依賴項錯誤

我可以分別調試應用程序A和應用程序B. 但是,當應用程序B從A調用REST API,我收到DLL相關性錯誤,從應用A.

「無法加載文件或程序集Newtonsoft.Json'或其依賴項之一,位於集清單定義不匹配程序集參考「。

當我清理生成項目A時,第一次調用成功,但是後續調用收到相同的錯誤。

我該如何解決這個問題?

(我使用IIS 7.5)

+0

整合您的NuGet包。 –

+0

@Ahmet Altun,你現在可以調試你的兩個項目嗎?如果您有任何最新信息,請隨時在此分享。 –

回答

0

爲了解決這個問題,請註明確保您的兩個項目中使用的相同Newtonsoft.Json版本。

您可以運行下面的命令:

更新包Newtonsoft.Json -reinstall

也請查看你的web.config,也許你可以刪除舊版本,如:

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

一般來說,如果我們想確保所有的Newtonsoft.Json包都是相同的版本,我們也可以指定版本:

更新包Newtonsoft.Json - 版本6.0.0 -reinstall

參考:

Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0

http://blog.myget.org/post/2014/11/27/Could-not-load-file-or-assembly-NuGet-Assembly-Redirects.aspx