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 1.0.10.0 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” 1.0.10.0

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

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 2.0.43.0 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: 1.0.10.0 and confirmed the deletion. Then the usual reset of the build number and lo: everything was hunky dory again!

Happy Coding!!

Advertisements
Posted in Visual Studio

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 May 23, 2017
    Dilbert readers - Please visit Dilbert.com to read this feature. Due to changes with our feeds, we are now making this RSS feed a link to Dilbert.com.
%d bloggers like this: