R – Can TeamCity’s .NET NUnitaddin process csproj files

csprojnantnetnunitteamcity

To cut to the chase, can the TeamCity .NET NUnitLauncher process Microsoft csproj files?

I ask this question because of the following.

I have a NANT build script. In this script I have a number of tests which use nunit-console.exe (which ships with NUnit v2.5.2).

An example of a test in my Nant build file is:

<target name="x.Commons.Tests" depends="xCore">
<exec program="${nunit-console.exe}" commandline="${nunit-console.args} Core\x.Commons.Tests\x.Commons.Tests.csproj" failonerror="${nunit-console.failonerror}"/>
 </target>

FailOnError is set to false, and the nunit-console.args is set to '/nologo'.

When I run these tests on my local machine I get test output. However when I instruct TeamCity to build my NAnt build file, and instruct it to process the test targets I get no test output to TeamCity. I can see in the log that nunit-colsole.exe is producing test result output but Im not seeing this in the TeamCity dashboard.

After reading around I found some articles indicating that extra steps are required to get this input into TeamCity. Hence I modified my test to:

    <target name="x.Configuration.Tests" depends="xCore">
  <mkdir dir="C:\Tools\NUnit\bin\net-2.0\addins"/>
  <copy file="${teamcity.dotnet.nunitaddin}-2.5.0.dll" todir="C:\Tools\NUnit\bin\net-2.0\addins"/>
  <copy file="${teamcity.dotnet.nunitaddin}-2.5.0.pdb" todir="C:\Tools\NUnit\bin\net-2.0\addins"/>
  <exec program="${nunit-console.exe}" commandline="${nunit-console.args} Core\x.Configuration.Tests\x.Configuration.Tests.csproj" failonerror="${nunit-console.failonerror}"/>
 </target>

Note that I also made sure the tag contains an entry of 'addins'.

However, as before I can see that the tests are working as the nunit-console.exe displays its results in the log, but Im getting no output to TeamCity.

An answer to my question, or any help would be appreciated!

Best Answer

Use

<copy file="${teamcity.dotnet.nunitaddin}-2.5.2.dll" todir="C:\Tools\NUnit\bin\net-2.0\addins"/>
<copy file="${teamcity.dotnet.nunitaddin}-2.5.2.pdb" todir="C:\Tools\NUnit\bin\net-2.0\addins"/>

TeamCity Addin for NUnit version should match NUnit version. Please check you TeamCity version supports NUnit 2.5.2 or download newer build.