Bill Wang’s Blog

November 5, 2008

BuildStep task statuses

Filed under: Uncategorized — Tags: — Bill @ 11:33 am

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 don’t 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” />
<!–Add tasks here–>
<BuildStep TeamFoundationServerUrl=“$(TeamFoundationServerUrl)”
BuildUri=“$(BuildUri)” Id=“$(MyBuildStepId)” Status=“Succeeded” />
<OnError ExecuteTargets=“HandleMyBuildStepFailed”/>
<Target Name=“HandleMyBuildStepFailed”>
<BuildStep TeamFoundationServerUrl=“$(TeamFoundationServerUrl)”
BuildUri=“$(BuildUri)” Id=“$(MyBuildStepId)” Status=“Failed” />

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.


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at

%d bloggers like this: