Migration from 4.1 to 5.0 problems

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

Hello.

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=4.1.0.0, 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
URI: http://127.0.0.1/gm/ScriptResource.axd?d=1a3ivYNBKD0HBIH7Q92ZxgGQeR3fGk61uj20mNekonCOuDqCThUN-vlOElf-HD51O8lteqOgRxQVu5al9ZLmgyLAc6zOFbcZQU03Bkm2IKs9MFbed-yvU1bYkjO-o5rl0&t=16ab2387

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.

Regards,
S.V.

 

May 20, 2010 at 11:53 PM

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

 

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

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

Hello,

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

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

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


Thanks,
S.V.

May 21, 2010 at 3: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.
entlib.support@Avanade.com

May 21, 2010 at 1: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 1: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.
entlib.support@Avanade.com

Jun 4, 2010 at 3: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?

Regards,
Stelios.

Jun 6, 2010 at 11:43 PM

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.
entlib.support@Avanade.com

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

Hello.

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,
Stelios.

Jun 8, 2010 at 8: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.
entlib.support@avanade.com

 

 

 

 

Jun 8, 2010 at 8:40 AM

Hello.

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.

Thanks,

Stelios.

 

Jun 8, 2010 at 8:51 AM

Good news then..=)

Jun 23, 2010 at 6: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 9: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.

web.config
<configuration>
    <configSections>
 <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 4: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
entlib.support@live.com
Enterprise Library support engineer
Support How-to