EntLib Side-by-Side Deployment 3.1 and 4.1

Topics: Logging Application Block
May 6, 2010 at 7:57 AM

Need some help on the side-by-side execution of EntLib, would like to know if anyone can shade some light on this.

Scenario:

Using WCF with EntLib 4.1 which in turn uses a third party product - ILOG (which uses EntLib 3.1).

Both EntLib 3.1 and 4.1 had been dumped into GAC.

Upon execution, confirmed that the third party product is loading EntLib 3.1 Logging assembly.

 

Error Message:

{"Unable to cast object of type 'Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings' to type 'Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings'."}

 

Original configuration was:

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

I've tried adding different configuration:

    <section name="loggingConfiguration31" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

Together with their respective loggingConfiguration and loggingConfiguration31 sections.

Inspecting the exception, verified that the error message was from the 3.1 EL Logging assembly.

 

May 7, 2010 at 12:20 AM

Although you can use 3.1 and 4.1 side-by-side, you can only refer each assembly to only one version of Entlib.  In your case,  your config references the 4.1 version but your third party product is using the 3.1 version.

 

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

May 7, 2010 at 2:11 AM

Apparently I have both the following in my configuration file, which is specific to each of the EntLib version.

    <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="loggingConfiguration31" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

The third party assembly is loading the 3.1 version of EntLib, but it seems like even with the versions specified in the config, it is not being honored.

Did I missed out something?

 

Thanks!

May 7, 2010 at 2:23 AM

That's the problem, as I said, you can only refer to only one version of an assembly.  Either you use the logging assembly version 3.1 or 4.1.  You can't use both in the config file.

 

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