Visual Studio Team System
BuildStep Task

The BuildStep task is a convenience task that adds, and potentially updates via the output ID property, a BuildStep.

Parameters

Parameter

Description

TeamFoundationServerUrl

Specifies the Team Foundation Server URL.

For example, http://MyServer:8080.

BuildUri

Specifies the build URI.

Name

Specifies the name of the build step that this task adds.

Message

Specifies the message that is displayed in the build report in the build steps section.

Id

Specifies the optional input/output parameter. If specified, this is the ID of the build step that is updated. If not specified, a new build step is created.

Status

Specifies the status for the build step.

For example, Succeeded, Failed, or Stopped.

Example

The following example creates and then updates a build step called MyBuildStep. It uses the Id parameter to refer to the build step.

When the first BuildStep task runs, the build report displays the message "My build step is executing." After the second BuildStep task has ran, the succeeded status icon appears next to the build step. For more information, see How to: View a Build Report and Walkthrough: Customizing Team Foundation Build with a Custom Task.

<BuildStep TeamFoundationServerUrl=”$(TeamFoundationServerUrl)” 
BuildUri=”$(BuildUri)” Name=”MyBuildStep” 
Message=”My build step is executing.”>
    <Output TaskParameter=”Id” PropertyName=”MyBuildStepId” />
</BuildStep>

<BuildStep TeamFoundationServerUrl=”$(TeamFoundationServerUrl)” 
BuildUri=”$(BuildUri)” Id=”$(MyBuildStepId)” Status=”Succeeded” />

The following example creates a build step called MyBuildStep without using the Id parameter.

<BuildStep TeamFoundationServerUrl=”$(TeamFoundationServerUrl)” 
BuildUri=”$(BuildUri)” Name=”MyBuildStep” 
Message=”This is a status message.” Status=”Succeeded” />
See Also

Tasks

Other Resources

Tags :


Community Content

Stephen W. Nuchia
failed?
So, how do we mark one as failed? When a task fails between a create / mark-succeeded pair the buldstep is left with the "in progress" icon, even when the build is no longer running.
Tags :

Bill.Wang
Detail description about build step statuses

Copied from my blog: http://billwg.wordpress.com/2008/11/05/buildstep-task-statuses/

.

The BuildStep task enables us to add custom build steps to a team build report. This task exposes 3 possible statuses that we can set to:

  • Succeeded
  • Failed
  • Stopped

Plus one more status which is not exposed:

  • InPrograss

The default status of a build steps is InPrograss. If we dont set the status, the build step status in the result build report will be:

  • Failed if the team build is aborted. When we stop a team build, all build steps with InProgress status will be marked to Failed.
  • InPrograss if the build completes normally.

As we already know, we can open the build report before the build is finished. When the build engine meets a BuildStep task declaration, it will add an item to the “Build steps” section in the team build report. We usually declare a BuildStep task with the default status InPrograss to show the build engine is performing a set of tasks, then we set the status of the BuildStep when our tasks are finished.

The following example demonstrate how to organize build step declaration and evaluation. The example overrides AfterDropBuild target to run some tasks there. If no error occurs, the status for the build step will be set to Succeeded. If there’s an error encountered in AfterDropBuild target, HandleMyBuildStepFailed target will be executed.

<Target Name="AfterDropBuild">

<BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)"

BuildUri="$(BuildUri)" Name="MyBuildStep"

Message="My build step is executing.">

<Output TaskParameter="Id" PropertyName="MyBuildStepId" />

</BuildStep>

<!--Add tasks here-->

<BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)"

BuildUri="$(BuildUri)" Id="$(MyBuildStepId)" Status="Succeeded" />

<OnError ExecuteTargets="HandleMyBuildStepFailed"/>

</Target>

<Target Name="HandleMyBuildStepFailed">

<BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)"

BuildUri="$(BuildUri)" Id="$(MyBuildStepId)" Status="Failed" />

</Target>

What I have missed? Oh, the Stopped status. If the status of BuildStep task is set to Stopped, the whole team build will be stopped. Thus we rarely use this status.

Tags : teambuild

Page view tracker