How to edit TFS 2012 Build definitions and make changes to the Builds

 

This gets asked quite often, hence the post  – how do I make my build to run on a particular machine only?. How to turn OFF work item creation on Build failure (as we have a high number of failures due to unstable builds) and while we are investigating that, we don’t want to create WIT failures, while we are working on the build stability issues?.

There are a couple of approaches to this, and I outline both and for the easier of the two I have also provided screen shots to follow.

  • (A) one is to edit the build definition, post-facto, after you created one, and the easiest
  • (B) The other is to edit the default template that comes with the product which is a bit involved. You will do this if all new Build definitions created have to be spun off with some default values (for your specific deployment of TFS Build), which are *NOT* what comes as default with the TFS provided templates.

For (A) – the easiest

Assuming you are on 2012, here is how you would do it. I am attaching a screen shots that show this on editing the Build Definition, after one has initially created a Build definition.

1. Build machines can be specified by using the Agent “tag” mechanism.

a. So you would open up the Build Controller and tag the build machines with a specific label. Steps are shown below for Agent tagging. Right Mouse on Actions (under Builds as shown) to start the sequence.

clip_image002

 

clip_image004

 clip_image006

b. Then you would use/filter the builds to the specific tags you created, so that the builds get done only on those machines. Rest of the steps are done in the Build Definition which screen shot is shown below.

2. How to toggle Create Workitems on Failure, and unset it, so that you don’t create a WIT on each build failure.

a. Go to the process tab (as shown on the screen shot below) and toggle from “True” to “False”]

clip_image008

For (B)

You will have to use Windows Workflow to either (a) create a new Build process template from scratch the way you want it OR (b) edit an existing XAML workflow file. This involves some learning and knowledge of Windows Workflow to do it. You can find information on this MSDN link below on how to do it.

https://msdn.microsoft.com/en-us/library/dd647551.aspx