19

I am trying to upgrade Unity to version (2.1.505.2), but when I run the application I get the following FileLoadException

Could not load file or assembly 'Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.

We are upgrading from Unity 2.0.414.0 to 2.1.505.2.

  • All project references in the solution that refer to Unity refer to the correct version of the dll
  • There is no Unity dll referenced in the Gac. (double checked by checking gacutil -l)
  • I removed all Unity dlls from the archive. Double checked with powershell

    PS C:\> ls -rec -inc Microsoft.Practices.Unity.dll | foreach-object { "{0}`t{1}" -f $_.FullName, [System.Diagnostics.FileVersionInfo]::GetVersionInfo($_).FileVersion }
    

How can I find out what / who still refers to the Unity 2.0.414.0?

FusionLogVw doesn't tell me which DLL is causing the problem.

Any help is much appreciated!

4

7 に答える 7

4

バインド リダイレクトは、適切なアセンブリ バージョンを指す必要があります。

あなたの場合、バージョン 2.1.505.0を使用する必要があります!

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <assemblyIdentity name="Microsoft.Practices.Unity" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-2.1.505.0" newVersion="2.1.505.0" />
  </dependentAssembly>
</assemblyBinding>

次の理由により、2.1.505.2を指定できません。

ここに画像の説明を入力

Unity アセンブリ2.1.505.2には、 AssemblyFileVersionAssemblyVersionで指定された異なるバージョンがあります。

CLR は AssemblyVersion で動作しており AssemblyFileVersion無視されますが、NuGet はAssemblyFileVersionで動作しています。

だから、あなたはこの違いを持っ​​ているのです!

AssemblyVersionを使用してください

于 2014-11-26T11:07:10.293 に答える
0

あなたの新しい質問は、アセンブリに対する既存の依存関係を見つけることに関するものなので、次の質問を参照してください。

特定の依存関係の特定のバージョンに依存するものを見つける方法は?

Fuslogvw.exeを使用することを指します

于 2014-01-20T20:57:56.183 に答える
0

resharper をお持ちの場合は、問題の参照を削除してビルドし、それが使用されているクラスに移動して (エラーがあります)、resharper を取得して修正してください。

面倒なことは省きますが、誰もがリシャープを持っているわけではないことに感謝します:D

于 2015-02-04T11:12:34.780 に答える