This page last changed on Mar 14, 2009 by dcameron.

The <msbuild> task is used to execute MsBuild projects, which are the default project format for Visual Studio 2005 projects and can also be compiled by using the MSBuild application that ships with the .NET 2 Framework.

In order to work with the results of MsBuild it is important to use a custom xml logger to format the build results. For details on this, and a tutorial on how to use the task, see Using CruiseControl.NET with MSBuild.

Many thanks to Szymon Kobalczyk for helping out with this part of CruiseControl.NET.

Examples

Minimalist Example:

<msbuild />

Full example:

<msbuild>
  <executable>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe</executable>
  <workingDirectory>C:\dev\ccnet</workingDirectory>
  <projectFile>CCNet.sln</projectFile>
  <buildArgs>/noconsolelogger /p:Configuration=Debug /v:diag</buildArgs>
  <targets>Build;Test</targets>
  <timeout>900</timeout>
  <logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
</msbuild>

Configuration Elements:

Node Description Type Required Default
executable The location of the MSBuild.exe executable string false C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe
workingDirectory The directory to run MSBuild in - this is generally the directory containing your build project. If relative, is a subdirectory of the Project Working Directory string false Project Working Directory
projectFile The name of the build project to run, relative to the workingDirectory. string false the build file MSBuild uses by default
buildArgs Any extra arguments to pass through to MSBuild string false  
targets A semicolon-separated list of the targets to run string false the default project target
logger The full path to the assembly containing the custom logger to use. Arguments can be passed to the logger by appending them after the logger name separated by a semicolon. Only if the assembly contains more than one logger implementation you need to specify the logger class (see MSBuild reference):
[LoggerClass,]LoggerAssembly[;LoggerParameters]
string false ThoughtWorks.CruiseControl.MsBuild.XmlLogger,ThoughtWorks.CruiseControl.MsBuild.dll
timeout Number of seconds to wait before assuming that the process has hung and should be killed. int false 600 (10 minutes)
description If filled in, this will be shown in the buildstage as the process name
string
false
n/a

Integration Properties

The following parameters are passed to MSBuild as command-line arguments:

Label Description Example
CCNetBuildCondition The condition used to trigger the build, indicating if the build was triggered by new modifications or if it was forced. Legal values are: "IfModificationExists" or "ForceBuild" ForceBuild
CCNetIntegrationStatus The status of the current integration. Could be Success, Failure, Exception or Unknown Success
CCNetLabel The label used to identify the CCNet build. This label is generated by the CCNet labeller. 1.0.2.120
CCNetLastIntegrationStatus The status of the previous integration. Could be Success, Failure, Exception or Unknown Success
CCNetProject The name of the CCNet project that is being integrated. MyProject
CCNetBuildDate The date of the build (in yyyy-MM-dd format) 2005-08-10
CCNetBuildTime The time of the start of the build (in HH:mm:ss format) 08:45:12
CCNetArtifactDirectory The project artifact directory (as an absolute path) c:\program files\CruiseControl.NET\Server\MyProject\Artifacts
CCNetWorkingDirectory The project working directory (as an absolute path) c:\program files\CruiseControl.NET\Server\MyProject\WorkingDirectory
CCNetRequestSource The source of the integration request; this will generally be the name of the trigger that raised the request. (Added in CCNet 1.1) IntervalTrigger
CCNetFailureUsers The list of users who have contributed modifications to a sequence of builds that has failed. John, Smith
CCNetListenerFile Viewing build progress with Nant and MSBuild (Added in CCNet 1.4) c:\Project\Artifact\listener.xml
CCNetProjectUrl The URL where the project is located http://myhost/ccnet/server/
CCNetNumericLabel Contains the label as an integer if conversion is possible, otherwise zero. 1
CCNetModifyingUsers
The list of users who have contributed to the current build only
Smith

Availability

The MsBuild plugin is available in builds more recent than 0.9.2.1059.

Document generated by Confluence on Mar 14, 2009 02:55