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

May 6, 2010 at 2:56 PM

I a having the following error message:

The type initializer for 'Microsoft.Practices.EnterpriseLibrary.Caching.CacheFactory' threw an exception.

Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Practices.ObjectBuilder2, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

I am having the following refernces:

Microsoft.Practices.EnterpriseLibrary.Common, Microsoft.Practices.EnterpriseLibrary.Caching

The code is as follows:

[13:04:50] Shamima:   private static ICacheManager GetCacheManager()
Line 31:         {
Line 32:             return CacheFactory.GetCacheManager(cacheManagerName);
Line 33:         }
Line 34:     }
Help please, how can I eliminate the error message?
May 7, 2010 at 12:55 AM

Add reference to the ObjectBuilder2 assembly.  This assembly performs the task of creating and disposing of object instances for the entlib blocks.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
 entlib.support@avanade.com

May 7, 2010 at 6:34 AM

Hi, where can I have the ObjectBuilder2 assembly? What I find strange is that my colleagues have the same references on their PC and it`s working fine for them without any reference to the ObjectBuilder2 assembly. 

May 7, 2010 at 6:37 AM

Hi, where can I have the ObjectBuilder2 assembly? What I find strange is that my colleagues have the same references on their PC and it`s working fine for them without any reference to the ObjectBuilder2 assembly. 

May 7, 2010 at 6:58 AM

I have downloaded the ObjectBuilder2, and referencing it.  Now I am having the error message:

Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Caching, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

May 7, 2010 at 7:07 AM

It seems you're using mixed versions of the assembly.  Are you using the strong-named versions or the one from the source code?  This is not a Unity issue, please post this in the EntLib forum to continue the discussion. http://entlib.codeplex.com/Thread/List.aspx

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
 entlib.support@avanade.com 

May 7, 2010 at 7:33 AM

I have downloaded the ObjectBuilder2 with a version 2.2.0.0 and I can see that the 'Microsoft.Practices.EnterpriseLibrary.Caching  version is 4.1.0.0.  What should I do?

May 7, 2010 at 8:10 AM

I posted my reply here - http://entlib.codeplex.com/Thread/View.aspx?ThreadId=211883.  Please continue the discussion there.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
 entlib.support@avanade.com