TFS 2010 Destroying unwanted builds

Hello World,

If you’ve worked with TFS builds for any length of time, you would’ve surely had days when the build just would not do what it is supposed to do: build stuff!!
We had this issue the other day when tfs build was stuck and some of my builds did not complete, yet the version numbers got incremented. Now what I wanted is to delete those “bad” builds, reset the build number and then fire a build that would get me the expected build number. I fired up my build explorer for the build definition in question and then clicked on “Delete Build”:




Next, reset the version number in the build configuration folder and queued up a new build. To my horror, TFS came back with this:
Build Failed: version already exists!

So, I turned to the trusted Visual Studio command prompt to look up the TFSbuild tool’s destroy command. MSDN describes this in detail. Unfortunately, the following command:

TFSBuild destroy /collection:http://tfs:8080/tfs/defaultcollection /BuildDefinition:”\Team Project\My Shiny Product”

Comes back with saying: No builds found for build specification ‘’.

I tried the /daterange switch then:

TFSBuild destroy /collection:http://tfs:8080/tfs/defaultcollection /BuildDefinition:”\Team Project\My Shiny Product” /daterange:~2012-03-27

Note that this would come back with a confirmation for each build for the team project in the date range, something similar to:
Destroy build record for MyShinyProduct Production permanently? (Yes/No/All)

Be very careful at what you respond ’cause you obviously do not want to delete somthing required!
I found the one I was interested in: and confirmed the deletion. Then the usual reset of the build number and lo: everything was hunky dory again!

Happy Coding!!

Posted in Visual Studio

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

  • Comic for July 25, 2017
    Dilbert readers - Please visit to read this feature. Due to changes with our feeds, we are now making this RSS feed a link to
%d bloggers like this: