Cloning Builds in TFS 2010 — Gotchas and Improvements

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’

17-09-2010 15-12-44

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

  1. Ok either way, give the build definition a proper name
  2. 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.
  3. Under Build Defaults, change your Drop Folder. I typically have each build going to its own unique folder, named as the build definition.
  4. 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 Smile

Can you think of any other improvements?



2 Replies to “Cloning Builds in TFS 2010 — Gotchas and Improvements”

  1. As per item 4 above, Update your Process. My project has a couple of hundred solutions to build. Is there an easy method to edit the solution paths to point to the new branch?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s