新しい MVC 4 Web サイトを作成しています。Unity.MVC3 ライブラリを使用して、MVC に組み込まれている DependencyResolver と統合したいと考えています。
また、以前のはるかに大規模なプロジェクトからいくつかのデータ アクセス DLL を参照したいと考えています。
私の問題は、Unity.MVC3 と古い DLL がそれぞれ異なるバージョンの Unity 1.2.0.0 と 2.1.505.0 に対してコンパイルされていることです。次のように、web.config ファイルにバインディング リダイレクトを作成してみました。
<dependentAssembly>
<assemblyIdentity name="Microsoft.Practices.Unity" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersions="1.2.0.0-2.1.505.0" newVersion="2.1.505.0" />
</dependentAssembly>
ただし、まだ次のエラーが表示されます。
Could not load file or assembly 'Microsoft.Practices.Unity, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
アセンブリ バインディングのログ記録をオンにすると、最後の 2 行で次のように表示されます。
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
バインディング リダイレクトが尊重されないのはなぜですか? メジャー バージョンの競合のチェックを無効にする方法はありますか?