Migration from 4.1 to 5.0 problems

Topics: Caching Application Block , Enterprise Library Core, General discussion
May 20, 2010 at 11:11 AM


We had a workable Visual Studio 2008 ASP.Net project which included usage of the Enterprise Library 4.1.

Recently we decided to upgrade to:
Visual Studio 2010
.Net Framework 4
Enterprise Library 5.0

The Visual Studio migrated the application successfully and the project was able to compile.
Once accessing the website though we get the following error:
Message: Sys.WebForms.PageRequestManagerServerErrorException: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Data, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Line: 868
Char: 13
Code: 0

Note that all references from the entLib 4.1 were removed in the solutions and new references for version 5.0 where added (Even Enterprise Library 4.1 was removed from the computer using the control panel).

I have no idea how to solve the above problem.



May 21, 2010 at 12:53 AM

Did you update your configuration files to refer to the 5.1 version?


Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.

May 21, 2010 at 4:39 AM
Edited May 21, 2010 at 4:41 AM


The only reference there is in the web.config is the following:

   <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data"/>

The above was also like that, even with version 4.1. What kind of update are you referring to?


May 21, 2010 at 4:57 AM

Ok, could you try fully qualifying the assembly name by adding

, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

As of now, I could only think of the configuration file that would cause it to look for the 4.1 (unsigned) assemblies since you said that the references were updated accordingly.  Make sure that you do this for all the other entlib assemblies referred to in the config file.


Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.

May 21, 2010 at 2:07 PM
Hello. I have made the change, now my web.config file looks like this: <configSections> <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </configSections> Unfortunatelly though I get exactly the same error message as before. Any other suggestion? Thanks, S.V.
May 24, 2010 at 2:27 AM

Have you tried searching for the text 4.1 in your entire solution just to make sure?  Any chance there are 4.1 entlib assemblies in GAC and some of your project references for entlib have their Copy Local property set to False? 


Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.

Jun 4, 2010 at 4:34 PM

Hello and thanks for the support.

I have searched the entire solution for the text 4.1 but nothing has been found!

I have also verified that ‘Copy Local’ is set to ‘True’ in the project for both files: Microsoft.Practices.EnterpriseLibrary.Common.dll and Microsoft.Practices.EnterpriseLibrary.Data.dll. Also I checked the files in the Bin folder, where the website is deployed and are of the correct version: 5.0.414.0.

How can I check or remove the references from the GAC?


Jun 7, 2010 at 12:43 AM

If Copy Local is set to True for your entlib references, then you're not referencing from GAC.  Anyway, to check if you have entlib assemblies from GAC, just go to C:\Windows\assembly.

Any chance you're referencing a class library which in turn references a  4.1 version of Enterprise Library?


Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.

Jun 7, 2010 at 4:34 PM
Edited Jun 7, 2010 at 4:34 PM


The 'Copy Local' is set to True for both Microsoft.Practices.EnterpriseLibrary.Common & Microsoft.Practices.EnterpriseLibrary.Data in the project.

I have also checked the C:\Windows\assembly and I could not find any of the above libraries.

What do you mean by 'referencing a class library'? On my project I added these two libraries by: Right click on Project References and then under .NET I picked up the two libraries.

It is very strange because there is no existance of the version 4.1 on my computer, no reference in the project but still the same errornmessage comes up.

Thanks and regards,

Jun 8, 2010 at 9:27 AM

I believe what Sarah is pertaining to regarding "referencing a class library" is if the implementation of the application block resides in a different class project.

Anyway, please see if this FAQ item may help http://entlib.codeplex.com/wikipage?title=Why%20am%20I%20getting%20the%20messages%2c%20%22Could%20not%20load%20file%20or%20assembly%22&referringTitle=EntLib%20FAQ. Basically this discusses conflicts that may occur if the EntLib assembly referenced in the application mismatched with the version of the configuration tool that created the configuration file. Also, check for the resolution stated there or from Tom Hollander's blog and see if this may help you with your current problem.   

Gino Terrado
Global Technology and Solutions
Avanade, Inc.





Jun 8, 2010 at 9:40 AM


Basically, this is the problem.

The website is referencing another library (DAL Project) which is actually referencing directly the EntLib. I looked in the web published directory and I noticed that the DAL.dll was out of date. This was the reason for the wrong reference.

Using the Visual Studio I managed to update the reference. Problem now is sovled.




Jun 8, 2010 at 9:51 AM

Good news then..=)

Jun 23, 2010 at 7:50 PM

This article/discussion really helped me as well.

It turned out for me that adding , Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 in my web.config fixed my issue.

Thanks so much for the posting/support!!!!

Jun 13, 2013 at 10:38 PM
I have the same problem
I got a shell project using EnterpriseLibrary.Security but he still asking for v3.1 and I cant install it.
I got 5.0.141
I tried to add in web.config but same error.

 <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    <section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"  /> <!--requirePermission="true"  />-->
    <section name="securityConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Security.Configuration.SecuritySettings, Microsoft.Practices.EnterpriseLibrary.Security, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"  /> <!--requirePermission="true"/>-->
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    <section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Jun 14, 2013 at 5:29 AM
In general, you should add a reference to the Enterprise Library assemblies and update the configuration to reference those assembly versions.

If you have one assembly that requires 2 different versions of Enterprise Library then I don't think that will work. If you have another assembly (like a third party assembly) that is referencing a different version of Enterprise Library then you could install the assemblies in the GAC or try using the approach outlined in this post to manually load assemblies: http://entlib.codeplex.com/discussions/363098

Randy Levy
Enterprise Library support engineer
Support How-to