views:

96

answers:

1

I have a C# app that references another C# dll which in turn uses Enterprise Library. Because my app has no config xml file for setting the Enterprise Library settings, it is throwing an error, specifically:

"The configuration section for Logging cannot be found in the configuration source."
"Microsoft.Practices.EnterpriseLibrary.Logging"

I would rather not add an XML config file to my app to just turn off Enterprise Library. Is there a code way to do so in my the source for my app?

EDIT:

I'm on EL 4.1

+2  A: 

I don't have details for the exact configuration you are looking for, but Enterprise Library 5 has a fluent configuration API you can use.

As far as I know, previous versions can only be configured via XML files.

Oded
Doh, sorry I'm on 4.1; will edit main config
Matt
you can use the configurationSource option to have it's configuration in another xml file than the main config file...
Tim Mahy
@Tim Mahy - But you still need at least one config file. The OP doesn't want _any_ configuration files.
Oded
You *can* programmatically configure Enterprise Library logging but you need to use the objects that you create directly -- you cannot just globally say to use this configuration information that was created programmatically.
Tuzo