2016-05-17 11 views
1

Newtonsoft.Jsonバージョン8にアップグレードしようとしていて、「ファイルまたはアセンブリを読み込めませんでした」Newtonsoft.Json、Version = 6.0.0.0。Culture = neutral、PublicKeyToken = 30ad4fe6b2a6aeed '見つかったアセンブリのマニフェスト定義がアセンブリリファレンスと一致しません。Newtonsoft.Json Assembly Conflict - DLL Hell

私のプロジェクト(または私のソリューション内のプロジェクト)はもうバージョン6を参照していません。私はインターネットとスタック交換を精査したが、提案のどれも働いていない。私はこれを私のweb.configファイルに掲載しました:

<dependentAssembly> 
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> 
    <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" /> 
</dependentAssembly> 

私のローカル環境でプロジェクトが正常に読み込まれます。メインにプッシュしてQAにデプロイすると、QAで爆発します。 Mainをローカルマシンにプルダウンし、同じエラーでクラッシュします。

私は完全に挫折しています。既にインターネット上で言及されているもの以外の提案があれば、それを聞いてうれしいです。

私はFusionを試しました(役に立たなかった)。

EDIT:

Fusionのエラーログ

*** Assembly Binder Log Entry (5/17/2016 @ 1:48:49 PM) *** 

The operation failed. 
Bind result: hr = 0x80131040. No description available. 

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll 
Running under executable C:\WINDOWS\SysWOW64\inetsrv\w3wp.exe 
--- A detailed error log follows. 

=== Pre-bind state information === 
LOG: DisplayName = Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed 
(Fully-specified) 
LOG: Appbase = file:///C:/Development/MyApp/Main/Services/MyAppInternal/MY.MyApp.Services.REST/ 
LOG: Initial PrivatePath = C:\Development\MyApp\Main\Services\MyAppInternal\MY.MyApp.Services.REST\bin 
LOG: Dynamic Base = C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\68a38e3a 
LOG: Cache Base = C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\68a38e3a 
LOG: AppName = fd029416 
Calling assembly : MY.MyApp.Services.REST, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. 
=== 
LOG: This bind starts in default load context. 
LOG: Using application configuration file: C:\Development\MyApp\Main\Services\MyAppInternal\MY.MyApp.Services.REST\web.config 
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. 
LOG: Post-policy reference: Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed 
LOG: GAC Lookup was unsuccessful. 
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/68a38e3a/fd029416/Newtonsoft.Json.DLL. 
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/68a38e3a/fd029416/Newtonsoft.Json/Newtonsoft.Json.DLL. 
LOG: Attempting download of new URL file:///C:/Development/MyApp/Main/Services/MyAppInternal/MY.MyApp.Services.REST/bin/Newtonsoft.Json.DLL. 
LOG: Assembly download was successful. Attempting setup of file: C:\Development\MyApp\Main\Services\MyAppInternal\MY.MyApp.Services.REST\bin\Newtonsoft.Json.dll 
LOG: Entering download cache setup phase. 
LOG: Assembly Name is: Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed 
WRN: Comparing the assembly name resulted in the mismatch: Major Version 
ERR: The assembly reference did not match the assembly definition found. 
ERR: Setup failed with hr = 0x80131040. 
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated. 

*** Assembly Binder Log Entry (5/17/2016 @ 1:48:49 PM) *** 

The operation failed. 
Bind result: hr = 0x80131040. No description available. 

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll 
Running under executable C:\WINDOWS\SysWOW64\inetsrv\w3wp.exe 
--- A detailed error log follows. 

=== Pre-bind state information === 
LOG: DisplayName = Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed 
(Fully-specified) 
LOG: Appbase = file:///C:/Development/MyApp/Main/Services/MyAppInternal/MY.MyApp.Services.REST/ 
LOG: Initial PrivatePath = C:\Development\MyApp\Main\Services\MyAppInternal\MY.MyApp.Services.REST\bin 
LOG: Dynamic Base = C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\68a38e3a 
LOG: Cache Base = C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\68a38e3a 
LOG: AppName = fd029416 
Calling assembly : MY.MyApp.Services.REST, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. 
=== 
LOG: This bind starts in default load context. 
LOG: Using application configuration file: C:\Development\MyApp\Main\Services\MyAppInternal\MY.MyApp.Services.REST\web.config 
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. 
LOG: Post-policy reference: Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed 
LOG: GAC Lookup was unsuccessful. 
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/68a38e3a/fd029416/Newtonsoft.Json.DLL. 
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/68a38e3a/fd029416/Newtonsoft.Json/Newtonsoft.Json.DLL. 
LOG: Attempting download of new URL file:///C:/Development/MyApp/Main/Services/MyAppInternal/MY.MyApp.Services.REST/bin/Newtonsoft.Json.DLL. 
LOG: Assembly download was successful. Attempting setup of file: C:\Development\MyApp\Main\Services\MyAppInternal\MY.MyApp.Services.REST\bin\Newtonsoft.Json.dll 
LOG: Entering download cache setup phase. 
LOG: Assembly Name is: Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed 
WRN: Comparing the assembly name resulted in the mismatch: Major Version 
ERR: The assembly reference did not match the assembly definition found. 
ERR: Setup failed with hr = 0x80131040. 
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated. 

はEDIT:

私は、溶液中のすべてのプロジェクトファイルを経て、それらはすべて、以下の方法Newtonsoft.Json参照:

<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> 
    <HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> 
    <Private>True</Private> 
</Reference> 
+1

他の環境の設定ファイルを見て、バインディングリダイレクトが含まれていることを確認しましたか? – mason

+0

このエラーはあなたが知る必要があることを教えてくれます:あなたのアプリケーション内のいくつかのアセンブリは、設定にリダイレクトがあってもなくても、まだバージョン6にリンクされています。 "Main"(ソースコントロール内のブランチ?ファイル内で外部エディタを使用する場合は、Fusionロギングを使用して、バージョン6を要求する呼び出しアセンブリを特定します。他の方法では、バージョン6(バージョン8に更新されていないため)およびバージョン6あなたのbinディレクトリで終わるので、あなたのメインアセンブリは参照をロードできません。 – CodeCaster

+0

はい、私は「Get-Project -All | Add-BindingRedirect」をパッケージマネージャコンソールで行っています。私はすべてを拭き取り、それを元通りに戻し、ビンを削除し、きれいにして、再構築を行った。 –

答えて

0

私が探していた答えではありませんでしたが、それは私の問題を解決しました。私はNewtonsoft.Jsonをバージョン6に戻しました。これは実行時エラーを取り除きました。私は本当に問題ではないはずの問題のトラブルシューティングに多くの時間を費やす余裕がありませんでした。

私のトラブルシューティングのすべてを行っているうちに、サードパーティの依存関係の多くがNewtonsoft.Json(さまざまなバージョンで)に依存していることがわかりました。 WebApi 2.2にはバージョン6が必要です。その他のバージョンではバージョン5が欲しいです。

このようなバージョンの要件は、bindingRedirectが作成されたすべての理由があります。だから私の問題は実際には設計どおりに動作していないbindingRedirectです。