The Team Foundation Server Power Tools September 2010 release has a handy new feature which allows you to clone your TFS Build definitions (i.e. create a copy) . It’s simple to use, all you do is right-click an existing build definition and select Clone Build Definition. In the image below I have cloned MyBuild and been provided with ‘Copy of MyBuild’
For consistency, it may be better if this copy was actually called ‘Clone of MyBuild’. Also, to save me several clicks, the definition of the build should be shown as no-one is going to clone a build and then do nothing with it.
So why would you clone a build? I can think of two reasons, firstly, to configure a build for a new branch and secondly to configure an additional schedule for a build. I would argue that doing it for creating an additional time based schedule, it may be better to simply use the Windows Task Scheduler so you don’t pollute your Builds node. Do you see yourself cloning for other reasons?
So now you have your cloned build. Please be aware that it an exact clone and it is created in an enabled state. This means that you could have multiple builds being triggered on the same trigger. I would prefer it if the cloned build was created in a disabled state.
If you are cloning to create a new branch build, you will need to do a few things
- Ok either way, give the build definition a proper name
- Update your workspace mappings to point to the new branch! TIP: if you have complicated mappings, this can be a pain! Try this: In the workspace mapping grid, press Ctrl+A to select all, then Ctrl+C to copy to the clipboard. Paste into notepad and do a find / replace, then copy back to the clipboard and Alt-Tab back to VS. Then, select the workspace mapping grid and press Ctrl+V. Your update mappings will appear in the grid.
- Under Build Defaults, change your Drop Folder. I typically have each build going to its own unique folder, named as the build definition.
- Update your Process to build the correct solutions or set your Configuration Folder Path for upgrade template builds. If you don’t change this then you will be building a new workspace with your old build. Stuff will break.
- It would be ideal if we could branch our build definitions, that way we could skip the workspace mappings (2) and the Process (4) updates.
So there you go, a somewhat easier way to configure your new builds, just beware of the gotchas, #4 caught me
Can you think of any other improvements?