views:

2288

answers:

1

I am running NUnit with the project named AssemblyTest.nunit. The test calls another assembly which uses the log4net assembly. This is using nunit version 2.4.3 with the .net 2.0 framework.

In TestFixtureSetup I am calling log4net.Config.XmlConfigurator.Configure( ) and am getting the following error:

System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> System.Configuration.ConfigurationErrorsException: Unrecognized configuration section log4net. (C:\path\to\assembly.dll.config line 7)

Is there a way to fix this without renaming the config file to 'AssemblyTest.config'?

+1  A: 

Create a separate config file for log4net with root element log4net.

In TestFixtureSetup create a FileInfo object for this config file and give it as argument to log4net.Config.XmlConfigurator.Configure( ).

gyrolf