Hello,
Wanted to see if
anyone has encountered this. The code that I am testing makes the following
call to determine the path of the \bin directory:
_strFilePath =
String.Format(System.AppDomain.CurrentDomain.SetupInformation.PrivateBinPath +
"\\" + TPR_CONFIG_FILENAME);
The
code is in a dll (Tpr.Common.dll) that is part of a set of dlls for a web
app, _strFilePath resolves to "C:\Inetpub\wwwroot\GC\bin\"
when running on my test box. TPR_CONFIG_FILENAME is set to "tpr.config" in the
code.
I created the
Tpr.Common.UnitTests.dll containing a set of Nunit tests to test Tpr.Common.dll.
When the tests are run in either Nunit's GUI or console
mode my tests passes. I then created a Nant script to call the
tests:
<nunit2>
<formatter type="Xml" outputdir="Build/Testresults/" usefile="true" />
<test assemblyname="C:\Inetpub\wwwroot\GC\bin\Tpr.Common.UnitTests.dll" />
</nunit2>
<formatter type="Xml" outputdir="Build/Testresults/" usefile="true" />
<test assemblyname="C:\Inetpub\wwwroot\GC\bin\Tpr.Common.UnitTests.dll" />
</nunit2>
The Nunit tests now
fails because it cannot located the Tpr.config file. After many trial and errors
I added a debug line as follows:
_strFilePath
= String.Format(System.AppDomain.CurrentDomain.SetupInformation.PrivateBinPath +
"\\" + TPR_CONFIG_FILENAME);
System.IO.StreamWriter sw = new
StreamWriter(@"c:\blah.txt");
using (sw)
{
sw.WriteLine("Config file path: " + _strFilePath);
}
When run through
Nunit sw = "C:\Inetpub\wwwroot\GC\bin\TPR.Config", when run through Nant sw =
"\TPR.Config"
For
whatever reason when Nunit is called through Nant
System.AppDomain.CurrentDomain.SetupInformation.PrivateBinPath returns no
information.
If I place tpr.config on the root of C:\ the file is then
located via Nant. Is there a way to manually set the bin path in
Nant?
Thanks,
David