Problem upgrading from 4.0 to 4.1

Topics: Enterprise Library Core, General discussion
Jun 2, 2009 at 3:26 PM
Edited Jun 2, 2009 at 3:44 PM

I installed Entlib 4.1 (unistalled 4.0) and updated all my project references.   I also updated the config file (manually) and confirmed it's integrity by opening it with EntLIb configuration tool that came with 4.1.  When I run my application I get the following:

{"An error occurred creating the configuration section handler for enterpriseLibrary.ConfigurationSource: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=4.0.0.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) (C:\\ASC Team Project\\ASC.PM\\bin\\Debug\\Shell.exe.Config line 13)"}

When I open my app.config in the EntLibConfig Tool it opens FINE

When I open my exe.config in the EntLibConfig Tool I get the same error as above

When I view the reference in Visual Studio under the Object Browswer I am definitely pointing to 4.1 here is the path:

Microsoft.Practices.EnterpriseLibrary.Common - C:\ASC Team Project\ASC\ASC.Assemblies\Enterprise Library\4.1\Microsoft.Practices.EnterpriseLibrary.Common.dll

Why does my exe.config still point to the 4.0 versions

Jun 3, 2009 at 3:41 AM

Have you tried deleting your exe.config and then running your app again?  Could you also check your machine.config for this section:

 <section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=4.0.0.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

Check if the referenced version is 4.0 or 4.1

 

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

Jun 3, 2009 at 8:57 AM
Edited Jun 3, 2009 at 8:59 AM

Hi i'm new to Enterprise Library and had similar errors opening a 2.0.0.0 versioned 'App.config' file with Enterprise Library 4.0 installed.

to jesterbrat11: could it be you have a wrong value for PublicKeyToken? The value you're using matches the value for Enterprise Library 4.0 i'm using, I suppose it is different for version 4.1? Also Version might have to be 4.0.0.1 instead of 4.0.0.0?

 

The way I finally managed to get rid of all errors was:

  • update project references (altough not required for simply editing the App.config file in the EntLibConfig Tool)
  • update all PublicKeyToken values, also the ones having 'null' values (from 'b77a5c561934e089' to '31bf3856ad364e35')
  • update all Version values to '4.0.0.0'

My exe.config file seemed to be automatically updated after successfully loading & saving App.config in the EntLibConfig Tool.

Is this the recommended way to upgrade existing projects/configuration files? Found it hard to believe I needed to manually edit App.config...

Thanks!

Jun 4, 2009 at 6:51 AM

Hi,

I think this one item from Ent Lib FAQ has the answer: http://entlib.codeplex.com/Wiki/View.aspx?title=Is%20it%20possible%20to%20upgrade%20a%20post%20version%202.0%20Enterprise%20Library%20configuration%20file%20to%20a%20newer%20version%3f&referringTitle=Home

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 4, 2009 at 7:21 AM

Thanks for clearing that up!