Share via


Reason Property

Important noteImportant Note:

This functionality is available only with the Service Pack 1 edition of Team Foundation Server 2008.

The Service Pack 1 edition of Team Foundation Server 2008, IBuildDetail contains a Reason property that is an enumeration of type BuildReason. This property displays the way that the build was triggered. For more information, see How to: Create a Build Definition.The allowed values are as follows:

  • Manual   This value indicates that the build was manually started by a user through the Queue New Build menu command in Team Explorer.

  • IndividualCI   This value indicates that the build was started because of a check-in, and the build definition is configured to build on each check-in.

  • BatchedCI   This value indicates that the build was started because of one or more check-ins, and the build definition is configured to accumulate check-ins.

  • Schedule   This value indicates that the build was started because it was scheduled to do this at a certain time, and the build definition is configured to build on a regular schedule if changes have been checked in.

  • ScheduleForced   This value indicates that the build was started at a set time and the build definition is configured to build on a regular schedule whether or not changes have been checked in.

The Reason property is listed in the build log. For more information, see Overview of Build Reports.

The Reason property is also an output property of the GetBuildDetails task, and as an MSBuild property is available in your TFSBuild.proj files. You can use this property to modify the build files, depending on the trigger. You can use the Reason property to do the following:

  • Distinguish how a build that is controlled by a particular build definition was triggered. You can then additionally customize the build outputs by setting various build properties to different values, depending on the build trigger.

  • Distinguish a particular build definition, when more than one build definition is configured to use the same TfsBuild.proj file.

For example, if you want to generate a custom build number for your nightly build, you can add the following XML to your TFSBuild.proj file:

<Target Name="BuildNumberOverrideTarget" Condition=" '$(Reason)' == 'Schedule' ">
    <MyBuildNumberGenerator TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)">
      <Output TaskParameter="BuildNumber" PropertyName="BuildNumber" />
    </MyBuildNumberGenerator>
</Target>

Additionally, the MyBuildNumberGenerator task must be registered and defined. For more information, see How to: Customize Build Numbers.

See Also

Concepts

Understanding Team Foundation Build Configuration Files

Other Resources

Working with Build Definitions in Team Foundation Build