Migrating custom TraceListener Configuration.Design assemblies

Topics: Building and extending application blocks, Logging Application Block
Apr 26, 2010 at 8:05 AM

Hello,

I have a custom TraceLister that has a Configuration.Design assembly used to assist me with EntLib 3.1 config console.  I have two questions regarding to migration of my Logging code-base from EntLib 3.1 to EntLib 5.

  1. What's the equivalent construct for the EntLib 5?
  2. I've tried to add a "Custom Trace Listener" trace listener. But, I had an error message from configuration tool because my assembly was built against .NET 4 in contrast to EntLib 5. Do I need to build EntLib from source code in order to avoid the problem?

Any help would be appreciated,

M. Inam

Apr 26, 2010 at 8:24 AM

You should have a class that inherits from TraceListenerData.  This is actually detailed in the documentation.  Please refer to it under Developing Applications with Enterprise Library -> Extending and Modifying Enterprise Library -> Creating Custom Providers for Enterprise Library  -> Creating  a Custom Provider.

On your second item, can't you just set the target framework assembly of your assembly to .net 3.5?

 

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

Apr 26, 2010 at 10:38 AM

The missing piece was the ConfigurationElementType ttribute needed to be added into my listener class.

The answer to your question regarding to my second point would be "No". We are implementing pure .NET code now as much as we can. I guess your question also answers my question. I need to compile against .NET 4. It's not a big deal if I did not have to sign the assemblies. Is there any possibility to put the key file in a global settings like GlobalAssemblyInfo and it would be used by all projects?

Thanks for your time,

M. Inam

 

Apr 27, 2010 at 1:18 AM

Yes, you can put the AssemblyKeyFile attribute in the GlobalAssemblyInfo.cs and it will automatically sign your projects with that key file after recompiling.

 

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