Could not load file or assembly 'Microsoft.Practices.Unity'

bas picture bas · Jan 20, 2014 · Viewed 40.6k times · Source

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!

Answer

bas picture bas · Jan 20, 2014

The problem was another Microsoft dll that refers to the old version of unity. I found this out be accident be checking the namespaces of every referenced dll, and found another dll that contained namespaces with "unity".

Updating:

  • Microsoft.Practices.EnterpriseLibrary.Common
  • Microsoft.Practices.EnterpriseLibrary.Validation

to latest released versions resolved the problem.

I hope I save the day for some lost soul out there who's also pulling his hair out over this issue... :)