Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Validation'

Topics: Data Access Application Block, Validation Application Block
Jul 27, 2010 at 3:10 AM

I am upgrading our very robust data layer class library to entlib5 and it is not going smoothly.

The application is erroring at this point:

this.database = EnterpriseLibraryContainer.Current.GetInstance<Database>();

The error is:

"Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Validation, Version=5.0.414.0, 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)"

I have entlib5 Common and Data referenced via the .Net tab.

Adding validation as a reference does not work. In the HOLs there are no requirements for validation. What is going on?




Jul 27, 2010 at 7:58 AM


Have you also added reference to Microsoft.Practices.ServiceLocation.dll?

Have you check if the dataConfiguration section in your configuration are configured properly (valid data provider, correct connection string and etc) , Also, could you post your configuration used in here so we can take a look at your problem closely. Thanks.

Gino Terrado
Global Technology and Solutions
Avanade, Inc.


Jul 28, 2010 at 3:34 AM

Adding more insights on this, it looks like you're using a different versions of the entlib assembly. Check if your config still refers to the 4.1 version or whatever version you are previously using.  If your config is referring to the 5.0 version, it should open up in the EntLib 5 configuration tool without any errors.  And check the properties of your entlib assembly references, check that the version number is 5.0.414.0.


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.