As you have read on this blog and others, the TFS 2010 build process’ now utilizes Windows WorkFlow to define it’s process. This means you can define Arguments to allow an option to be set in the Build definition instead of being hard coded in the process.
For example when you create a build definition the process tab allows you to set various options like Where to find unit tests, what is the build number format, should the build run Code Analysis? These are all defined as arguments in the build process so they can be changed when creating the build definition or even when you queue the build.
You can of course add your own arguments to a build process. Just to set the stage, lets say for example I wanted the build process to create a work item when the build completed. In the build toolbox there is an OpenWorkItem activity that I can use for this. We’ll have the build create a Task that has someone Validate the Build.
We can set the type and title of the work item we want created. However the AssignedTo might depend on the solution being built. We don’t want to hard code this in the build process but rather allow the author of the build definition the ability to set it for each type of build.
Set the Type = “Task”
Set the Title = “Validate Build (“ + BuildDetail.BuildNumber + “)”
Next create an argument called BuildValidator to take the name of the person the author of the build would like the Task assigned to.
At the bottom of the process editor click on the arguments button to show arguments for the process you are editing. In the last entry where it says Create Argument enter the name of your argument. In our case we’ll call it BuildValidator
Now we can go back and add BuildValidator to the AssignedTo property of the OpenWorkItem Activity to complete our process.
However lets set up some Metadata for this property. This is done using the Metadata Argument. In the list of arguments you will see one called Metadata click on the ellipsis under the Default Value column.
In the dialog that opens you can Add MetaData for a process parameter. Click the Add button and enter BuildValidator into the Paramater Name.
From the screen shot below you can see that you are able to set a DisplayName, Category, Description. Set an editor, whether or not it’s required and where it should show up.

Once you have the metadata entered Click OK, save the process and check it in.
Go and edit or create a build definition using this process and you will see your process argument with all it’s Metadata in the process tab of the build definition.
