As I mentioned in Slight introduction to Team Foundation Build 2010, individual build actions and their sequence are defined in a process template. That’s based on Windows Workflow Foundation 4.0, so it’s basically a text-based XAML file. But primarily there is a visual designer integrated to Visual Studio allowing you to define a process by simple dragging actions to the editor and setting some parameters.
Functionality related to builds, including process templates, is accessible from Team Explorer (node Builds in a team project). A new build definition can be launched by the New Build Definition option.
It opens a dialog where many useful parameters can be set, but in this moment the relevant thing is the Process tab and the Default process template section in its top part.
After Show details was clicked, you’ll see a combo box with a selection from existing templates and (among other things) the New button for creating a new template and a path to a template file.
You can see here that templates are saved to version control – Team Foundation Build can easily access them there.
After clicking the New button, a dialog is shown where you can choose the base template for the newly created one, the name of a new template and so on.
A new template file is created in background and set as the default in the the build definition dialog. By clicking the link you’re navigated to the template file in Source Control Explorer:
Doubleclick on the file opens the template in a designer integrated to Visual Studio. Because we built our template upon an existing one, the editor already shows a process definition.
Existing actions can be configured – simply click an action and adjust its properties in the Properties window:
or in some cases directly in the designer.
As you can see, many places allow you to write code (VB.NET) so you’re not limited by some predefined set of actions and operators. (We will look at variables in some future post.)
New actions can be simply dragged from Toolbox – either to a space reserved in some activity, e.g. in a conditional block:
or onto one of small triangles that are in many places in the default template:
These triangles are in fact a part of activity Sequence. Sequence is important, because for instance in the previous example, you can assign only a single action to If. If you need more actions, e.g. to create a folder and download files, you have to first drag Sequence to If and only then additional activities.
There are many activities and control structures available (and you can even define your own), just few of them for an illustration:
- ForEach – iterates though a collection and runs an action for each element
- TryCatch – error handling by the classic Try/Catch/Finally pattern
- LabelWorkspace – create a label in version control
- InvokeProcess – runs a command in command line
The description of predefine activities is available on MSDN.