This is my setup:
/
solution.sln
Core/
Core.csproj
web/
web.csproj
Web.config
Test/
Test.csproj
App.config
build/
_PublishedWebsites/web/etc...
test.dll
test.dll.config
Core.dll
log4net.dll
I wrote Unit Tests in the Test
project that test the functionality of the Core
project. All of the projects use log4net, all of them are configured using the respective App.config
or Web.config
files using
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
in their AssemblyInfo.cs
.
The projects are built using NAnt into a build
directory.
When I run the Unit Tests from Visual Studio (2010 Professional), everything works fine.
But when I try to execute MSTest directly
MSTest.exe /resultsfile:TestResults.trx /noisolation /testcontainer:build\test.dll
All test cases fail with the following error:
log4net:ERROR Failed to find configuration section 'log4net' in the application's .config file
This confuses me, because the test.dll.config
file most definitely contains the log4net
configuration section.
The folder created by MSTest also contains the config file:
/flopes_MyMachine 2015-10-08 08_48_59/Out/
Core.dll
test.dll
test.dll.config
log4net.dll
It appears to me that maybe MSTest
is using a wrong configuration file or doesnt find the configuration file of the test.dll
? Does that even make sense? Is there a way to tell MSTest which config file to use?
What is going on here?
Aucun commentaire:
Enregistrer un commentaire