23. August 2011 11:52
Ever had this annoying problem?
When you try to load a website, you get in the browser the nice message:
”Additional information: Could not load file or assembly 'Microsoft.Practices.Unity, Version=188.8.131.52, 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)”. When we we’re checking the Microsoft.Practice.Unity.dll Version, we are using the Version=2.0.414.0.
First we’ve cleaned up the whole project and try to build it. Building succeeded… So lets try again to approach the website with the browser. Still the same error. So, set the .dll file “Specific Version = false” in the properties window of Visual Studio. We thought this problem would be fixed, but it didn’t. Even while we are using a specific library folder, with only this specific.dll file, it #fails! to load the correct assembly.
Last change, lets clean up the whole bin folder, by deleting all the files, and recompile again. Again, no result.
After a time of struggle, we find out that we had also Enterprise Library 5.0 installed on the machine. At some strange way, EntLib 5.0 is messing up the references of the libraries and throws the Microsoft.Practice.Unity.dll from the GAC instead of the library folder.
After de-installing EntLib 5.0 software from the local machine (by de-installing, I mean ‘Add and Remove programs’), recompiling the code, and approach the website again by browser, everything works as it should be…