One of the teams, required a customized build note including only Bug, User Story work items listed with few details. The default alert email of the TFS 2013 only send an email in below format which does not say which is the type of the work item associated with the build. It just said “work item <id>” for any work item and team was not happy about that.
Very interesting solution provided here with PS scripts by MIKAEL DEURELL.
Few issues were there in the sample script provided in MIKAEL DEURELL‘s article the team who requested this specific build note is not happy about.
1. Since generating of build notes, depends on the date of the last good build to get the associated work items for current build, it is not possible to queue a build for a previous changeset, to make it the last good build, and another with latest changeset, will not send the associated work items correctly.
2. It sends all the work items and the team only wanted user story and bug WITs.
3. If a task work item associated it does not send the parent work item.
4. Team wanted the note to be formatted in a more readable format.
To overcome these issues the enhanced version (by me) of the sample script provided in MIKAEL DEURELL‘s article is below.
One more enhancement could be made to the script to generate the note in pre build and send it in post build. That is by changing the below script segment to write to a temp file in pre build.
Above can be changed as shown below so that it writes to a temp file in pre build.
In post build the temp file content can be read like shown below and send the email.
The build scripts should be checked in to TFS as shown below.
If there is multiple script then a run script can be used to call other scripts. For example pre build run script for above shown picture is below.
TFS build definition can be set to call the pre build and post build scripts.
With this build note as shown below can be obtained.