Could not load file or assembly 'Microsoft.Practices.Unity, Version=

by pazcal 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=, 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…

Add comment

  • Comment
  • Preview

My Apps

About the author

Pascal de Jonge is currently working as a Software Developer @ Sound of Data, Rotterdam, The Netherlands. Keywords for his work are Windows Phone and Windows Store, .NET, C#, XAML, jQuery, CSS...

In his smare time he runs a tiny (Web)Design/Development Company and play games.

Feel free to contact in several ways, like Twitter, the old fashion contactform or pascal[at]pazquality[.]com.

Widget Twitter not found.

Root element is missing.X

All postings/content on this blog are provided "AS IS" with no warranties, and confer no rights. All entries in this blog are my opinion and don't necessarily reflect the opinion of my employer or sponsors. The content on this site is licensed under a Creative Commons Attribution By license.