Logging Config Error

Topics: Logging Application Block
Feb 9, 2011 at 3:07 PM

I used the config tool to specify the System.Diagnostics.ConsoleTraceListener, but my client app fails with the exception message:

{"The type 'System.Diagnostics.ConsoleTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' cannot be resolved. Please verify the spelling is correct or that the full type name is provided."}

This also occurs for System.Diagnostics.DefaultTraceListener.

I'm using EntLib 5.0 and VS2010/.NET 4.0.

Feb 10, 2011 at 4:01 AM

Hi,

I'm trying to reproduce your problem using the same specification you've mentioned but unfortunately it doesn't happen in my end. Can you provide additional details on how are you doing this.

Gino Terrado
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 17, 2012 at 3:43 PM

I have this same problem. All I've done is add a new "listener" element in my configuration file as follows:

<add name="Console Trace Listener" type="System.Diagnostics.ConsoleTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.SystemDiagnosticsTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging" />
In case I was simply using incorrect version, culture, or public key information, I removed these fields to let the CLR automatically find whichever assembly it felt was the best match, but I still received the same error.

Apr 17, 2012 at 4:05 PM

The ConsoleTraceListener is requesting version 4 (.NET 4) so I would guess that the project is probably targeting an older version of the framework (e.g. 3.5).  Check the Target framework under project properties.

--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com