Problems with custom Trace Listener in Enterprise Library

Topics: Logging Application Block
Oct 30, 2008 at 10:39 AM

How it is described in msdn (http://msdn.microsoft.com/en-us/library/cc511727.aspx):
[ConfigurationElementType(typeof(CustomTraceListenerData))]
public class DebugTraceListener : CustomTraceListener

Errormessage:
 - The type or namespace name 'ConfigurationElementType' does not exist in the namespace 'System.ServiceModel.Configuration' (are you missing an assembly reference?)
 - The type or namespace name 'ConfigurationElementTypeAttribute' does not exist in the namespace 'System.ServiceModel.Configuration' (are you missing an assembly reference?)

I have seen the description of ServiceModelConfigurationElementCollection<(Of <(ConfigurationElementType>)>) Class.
 Namespace:  System.ServiceModel.Configuration
 Assembly:  System.ServiceModel (in System.ServiceModel.dll)
It does not work.

Problem:
 - Which Namespacee, Reference or Assembly do I have to use with ConfigurationElementType?
 - Where is this documented?

Thanks for your replies.

Oct 30, 2008 at 11:03 AM
It's in  Microsoft.Practices.EnterpriseLibrary.Common assembly.  Open the EntLib documentation, search for ConfigurationElementTypeAttribute in the Index tab.
Oct 30, 2008 at 11:38 AM
Thanks for your reply

What do I have to do, so that I can use Microsoft.Practices.EnterpriseLibrary.Common?
I am Using .Net 3.5 with SP1 and Enterprise Library 4.0
Oct 30, 2008 at 1:10 PM
Just add a reference to that assembly located in the Ent Lib's installation folder,  \install location\Program Files\Microsoft Enterprise Library 4.0 - May 2008\bin.  Then add a using statement in your class.

using Microsoft.Practices.EnterpriseLibrary.Common.Practices;
Nov 3, 2008 at 10:27 AM
Thank you for your aid.
It worked with using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;