Skip to end of metadata
Go to start of metadata
You are viewing documentation of TeamCity 4.x, which is not the most recent released version of TeamCity. Please refer to the listing to choose another version.

Table of Contents

Basic information on setting up the NAnt Build Runner can be found in the NAnt section of the UI Reference. This section contains information on working with the NAnt Runner. TeamCity supports NAnt 0.85 and NAnt 0.86 beta 1.

Setting the NAntHome Environment Variable

When selecting NAnt as the build runner, you need to specify the NAntHome environment variable on the agent machine with a path to the NAnt 0.85/0.86 beta 1 executables folder. This can be done by setting the environment variable on agent machine or by adding the env.NAntHome variable to the agent properties file or during the Properties and environment variables step when creating a build configuration.


Please note that the variable name is case sensitive.

MSBuild Task for NAnt

TeamCity NAnt runner includes a task called msbuild that allows NAnt to start MSBuild scripts. TeamCity msbuild task for NAnt has the same set of attributes as the NAntContrib package msbuild task. The MSBuild build processes started by NAnt will behave exactly as if they were launched by TeamCity MSBuild/SLN2005 build runner (i.e. NUnit and/or NUnitTeamCity MSBuild tasks will be added to build scripts and logs and error reports will be sent directly to the build server).


Since 4.1
msbuild task for nant will make all build configuration system properties available
inside msbuild script. Note, all property names will have '.' replaces with '_'.
To disable it, set false to set-teamcity-properties attribute of the task.

By default, NAnt msbuild task uses MSBuild 2.0 (from Microsoft .NET Framework 2.0), however you can use MSBuild 3.5 (from Microsoft .NET Framework 3.5) if you add the teamcity_dotnet_use_msbuild_v35 property with the value of true to your msbuild task in NAnt script. For example:


To pass properties to MSBuild, use the property tag instead of explicit properties definition in the command line.

<nunit2> Task for NAnt

To test all of the assemblies without halting on first failed test please use:


'failonfailureatend' attribute is not defined in the original NUnit2 task from NAnt. Note that this attribute will be ignored if the 'haltonfailure' attribute is set to 'true' for either the nunit2 element or the test element.

See Also: