where is ConfigurationElementType?

Topics: Logging Application Block
Apr 1, 2010 at 7:23 AM

in order to use a custom Trace Listener i need to specified the "type" property in the trace listeners properties.

when i push the "Type" button i see that it expects  "Classes that inherit from  CustomTraceListener and have a configurationElementType of CustomTraceListenerData"

so thats exactly what i did:

    class SendEmailTraceListener : CustomTraceListener

        public override void Write(string message)
            throw new NotImplementedException();

        public override void WriteLine(string message)
            throw new NotImplementedException();
but i get that "The type or namespace name 'ConfigurationElementType' could not be found"
why is ConfigurationElementType not identified by the compiler ? what do i have to include (assembly/using) to use it ?



Apr 1, 2010 at 7:35 AM

Hey rodnikoNo1,

You have to add a reference to the System.configuration assembly

Hope it will solve your problem.

Apr 1, 2010 at 7:54 AM

nope, that doesn't help.

System.Configuration does not have ConfigurationElementType attribute.

i think this is a bug in 4.1 version of Enterprise library.

i think ConfigurationElementType was inside "Microsoft.Practices.EnterpriseLibrary.Common.Configuration" in the 2.0 version.

but i can't find this dll in the 4.1 version!!!!


Apr 1, 2010 at 8:06 AM

Ok, Found the problem.

i found the dll : "Microsoft.Practices.EnterpriseLibrary.Common.dll" in "..\Program Files\Microsoft Enterprise Library 4.1 - October 2008\Bin" path

i referenced it and it worked.

afterward the compiler told to add a reference to System.Configuration too ( in this case you were right..).