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 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.
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.
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.