Enterprise Library Configuration Utility - Logging Problem

Topics: Logging Application Block
Jan 22, 2009 at 2:25 PM
Edited Jan 22, 2009 at 2:38 PM
Hi,

I am new to Enterprise Library and I have a problem with the Enterprise Library Configuration Utility.

I have developed a very simple application and used the Logging Quick Start App.config file. My application just save a log using the Event Log and Trace file. It worked OK and the config section of my App.config is like this:

<

 

configSections>

 

<

 

 

 

section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging" />

 

</

 

 

 

configSections>

 

 

 

When I save the same file without any modification using the Enterprise Library Configuration Utility the configSections of my App.config becomes like this:

<

 

configSections>

 

 

 

<

 

 

section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

 

 

 <

 

 

section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

</
configSections>

 

 

 

 

 

When I run my application again I receive the following error:

An error occurred creating the configuration section handler for loggingConfiguration: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.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:\VS Projects\Enterprise Library\Logging\SimpleLogging\bin\Debug\SimpleLogging.vshost.exe.Config line 3)

The application and the config file area the same, or it should be. Enterprise Library Configuration Utility made it more verbose and made a modification that made my application crash.

In fact the Configuration Utility changed all references to Enterprise Library like version including this: Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35. 

This update is returns the error above. When I return to my original App.config, file that came from the Quick Start, every thing works OK.

How can I solve this problem ???

Thanks in advance 

Jan 22, 2009 at 3:46 PM

Hi,

On your first item:
Have you opened the config file using the Stand alone tool? which is in All Programs > Microsoft Patterns and Practices > Ent Lib 4.1 > Enterprise Library Config.exe, I changed because the app.config from the Quick start is referencing the projects from the source code and not the binaries from the Program Files > ent lib > .... while the stand alone tool does references those binaries from the Program Files > ..... The binaries that can be found on the program files are pre-compiled binaries(this are strong-named), while the assemblies on the source code are not strong named.

On the second item:

You got that error probably because you are referencing the binaries from the source, ex: D:\EntLib41Src\bin... and not that are on the program files... Here is a much better explanation for this:

http://blogs.msdn.com/tomholl/archive/2007/04/19/avoiding-configuration-pitfalls-with-incompatible-copies-of-enterprise-library.aspx


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

Jan 22, 2009 at 4:19 PM
Hi,

It worked I simply included the libraries from the Program Files\Entlib and it is working Ok

Thank you very much