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)”
BuildUri=”$(BuildUri)”
CompilationStatus=”Succeeded”
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.
Thank, it helps a lot!
Comment by peter — November 24, 2008 @ 9:05 am
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
calling this target: ‘GetBuildProperties’ as you can see in ‘Microsoft.TeamFoundation.Build.targets’ file.
Comment by peter — November 24, 2008 @ 9:34 am