Bill Wang’s Blog

October 31, 2008

Custom build script succeeded while the Team Build failed

Filed under: Uncategorized — Tags: — Bill @ 11:52 am
Aaron Hallberg described how to kick off a custom build script in a team build. Please reference A Minimal TFSBuild.Proj File for more information. The interesting thing is that you may notice the team build fails even if the custom script executed successfully.

In a team build, the overall build status might be Succeeded, Partially Succeeded and Failed. The overall status will be


  • Succeeded if no error occurs.
  • Partially Succeeded if CompilationStatus is succeeded but error occurs in other part of the build
  • Failed if CompilationStatus is failed.

CompilationStatus and TestStatus are 2 properties created during a team build. When the build service is about to determine the overall build status, it checks CompilationStatus, TestStatus and other occurred errors. The default value for CompilationStatus and TestStatus is Unknown. Thus when you kick off custom build script by overwriting EndToEndIteration target, if CompilationStatus and TestStatus are not set, the overall status will be Failed even if no errors are listed in the build log. And SetBuildProperties task can be used to set them:

<SetBuildProperties TeamFoundationServerUrl=”$(TeamFoundationServerUrl)”
TestStatus=”Succeeded” />
After both CompilationStatus and TestStatus are set to Succeeded, the only factor that determines the overall build status will be an internal log property that tracks whether any error occurs. If there’s no error in the custom build script, then the overall build status will be Succeeded.




  1. Thank, it helps a lot!

    Comment by peter — November 24, 2008 @ 9:05 am

  2. Another issue:
    If you want to use some build properties like ‘RequestedBy’ or ‘RequestedFor’ then these properties are empty. You must call this target:

    or others parameters which you can find in ‘Microsoft.TeamFoundation.Build.targets’ file.

    Comment by peter — November 24, 2008 @ 9:33 am

  3. calling this target: ‘GetBuildProperties’ as you can see in ‘Microsoft.TeamFoundation.Build.targets’ file.

    Comment by peter — November 24, 2008 @ 9:34 am

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

Create a free website or blog at

%d bloggers like this: