In several posts of the past I dealt with customization of TFS 2010 build, but I never pointed out how to create a personalized build that can be used without always resorting to edit the workflow directly. Suppose you work heavily with database projects, and you need to deploy database project to different server in most of your builds. In this scenario each time you need to deploy a DB project you can create a new build process, edit it, add some customization and finally save and use it for the build.
This way to proceed is quite annoying, especially if you need to use custom build actions inside the build, and finally you will end with a customized workflow for each build. In this situation there is a better way to structure your builds. First of all copy the default build workflow and rename it:
Figure 1: Copy default workflow
Now edit the workflow and add all the arguments needed to deploy the database.
Figure 2: Add arguments to the new workflow, add all the argument needed to deploy a database project
Now thanks to Metadata Iâ€™m able to configure those arguments to give a better user experience, assigning a Category and descriptions to Arguments.
Figure 3: Add Metadata to configure all the arguments
Now I drop a DeployDatabase Activity inside the workflow, and use those four arguments to configure it.
Figure 4: Configure all properties of the Custom Action with the arguments previously declared (Figure 2)
Now I have a customized workflow, inside that workflow Iâ€™ve deployed a custom Activity, and finally Iâ€™ve declared arguments with metadata used to pass properties to the custom Activity. Now I can create a new Build, choose DefaultWithDeployDatabase workflow and all the parameters are now exposed directly without the need to edit the workflow.
Figure 5: Use the new workflow in a build.
The important stuff is that you can use modified workflow for several builds, because it can be reused.
Tags: TFS Build