Does anyone know how to use log4net.config files with Visual Studio 2008 unit testing?
I have a test project with a log4net.config file as part of the project, properties set to Content and Copy always, which diligently copies the config file to the bin\release or bin\debug folders on build. The test class [ClassInitialize] method includes this line: log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo("log4net.config")); which should point log4net to the executable folder for the test project, I thought. However the tests cannot find the config file: the log4net internal logging produces this message: log4net: XmlConfigurator: configuring repository [log4net-default-repository] using file [log4net.config] watching for file updates log4net: XmlConfigurator: configuring repository [log4net-default-repository] using file [log4net.config] log4net: XmlConfigurator: config file [C:\Documents and Settings\Neil\My Documents\Visual Studio 2008\Projects\MatrixRoot\Matrix5\TestResults\Neil_DEVNH 2008-05-16 15_50_22\Out\log4net.config] not found. Configuration unchanged. It seems to be looking for ...\TestResults\Neil_DEVNH 2008-05-16 15_50_22\Out\log4net.config but I do not understand why. Can anyone help with this puzzle? TIA