Enterprise Library Configuration

Topics: Developer Forum
Jun 1, 2007 at 2:52 PM
Edited Jun 1, 2007 at 2:52 PM

What do I have to do to correctly configure the enterprise library? I developed a sample short test, and I get

Tests.MyProject.Central.TestEnroll (TestFixtureSetUp) : System.Configuration.ConfigurationErrorsException : The configuration section for Logging cannot be found in the configuration source.

I tried creating a configuration both in the nunit.exe.config and the MyProject.Central.dll.config, but no luck

Any help would be appreciated.

João Pedro Martins

Ps: Note: I get this error in NUnit, while running the test. I have ent lib installed, signed and gac'ed.
Jun 3, 2007 at 9:07 PM
The logging needs to be in the tests.config file. We normally create the test project as a console application and an an app.config file and the entlib stuff goes in there.

I personally have never got a dll.config to work and basically a dll cannot have a config or is not supposed to have one since it provides some reusable functionality to a specific caller and therefore depends on the caller for context and configuration data. In some forums, people have posted that they got this to work, but its definitely not intended behavior.

There is no problem whatsoever in making your test app a console application though. I have used this for a long time (independent of BizUnit)

Jun 4, 2007 at 12:42 PM
Hello again,

I'll try that. What are you using as a configuration? is it in the source? More information/docs would be very helpful.

It it works in a console, it should work in nunit.exe.config as well (I think).

Thx again.
Jun 4, 2007 at 3:12 PM
Forget it, Benjy. I just pointed EntLib's config tool to the config file, added the logging part, and voila.

Alas, I think that maybe the sources could include this configuration out-of-the-box.

Thanks anyway.
Jun 4, 2007 at 8:53 PM
Hi Joao,
Glad you got it working with my appalling documentation (or lack of it!!! ) :-)
the problem though is that in the next version, its not going to work anymore because it required changes to the core and in the latest core code base, they are not included. Kevin is working on some DI mechanisms for injecting loggers etc into the bizunit constructor and as soon as that works with multithreading/parallel steps etc, we might be able to put this back again. Of course, you can always keep your version of the code with entlib if you want, but i wont be able to release that version anymore.. Sorry about that !!!