views:

98

answers:

0

Hi all:

I have a strange problem which I would like to hear from all the experienced developers out there...

Currently I have a MsBuild file with a target that executes a set of unit tests using a Java jar file. The target looks like this:

<Target Name="RunTests" >
  <MSBuild Projects="MyProject.csproj" />
  <Exec ContinueOnError="false" Command='java -Xmx256m -jar "$(JsTestDriverJarLocation)" --config "$(configFileLocation)" --port $(PortNum) --browser "$(BrowserPath)" --tests $(testsToRun) --testOutput "$(testOutputDir)" />
</Target>

The part that does not work properly is the testOutput. I wanted the test output files to be written to a specific directory e.g. rootDir\TestResults. The strange thing about it is that it only works with the "." directory, or the hardcoded equivalent (which is the project's root dir). I have tried with other directories, e.g. c:\, c:\test... none of them worked. They all returned an error saying The system cannot find the path specified at java.io.WinNTFileSystem.createFileExclusively. I used a dummy copy task to copy some files into rootDir\TestResults, and that worked. So I'm very confused as to whether this is a MsBuild problem, a bug in the Jar file, or some other problem e.g. unix to Windows permission problems.

The same command works if I run it in Windows command line (with minor changes to the config file).

I know this cannot really be answered by just a simple answer and would require further information/explanations, but I'm thinking whether someone has done something similar before and had strange experience with it as well.

Happy to provide further information/clarification. Thanks.