Nario
Nario

Reputation: 551

How to reset build number in TFS 2010

Can I reset build number in TFS 2010.

And another question. If Project have several build definitions, Can I keep build number for each build definition. Not create custom activity

Upvotes: 1

Views: 2302

Answers (2)

Keith Murray
Keith Murray

Reputation: 635

The only way I've found to reset build numbers (which I wanted to do after many failed builds as I was modifying scripts and whatnot) is to destroy all the builds you don't want.

In my case I just wanted to destroy all of the builds and start over. So I first deleted all of my retained builds in the Build Explorer in Visual Studio 2013. It is important to first delete all (or some number) of your builds before you destroy them.

Then I ran this command:

tfsbuild destroy /collection:http://mytfs2013server:8080/tfs/mycollection /builddefinition:"myteamproject\mybuildname" /daterange:~2015-1-1

I first ran it with the -preview parameter so that I would see what it was doing.

Once I destroyed all of the builds, I ran my build again and voila, back to build 1.

More information about destroy can be found here: http://msdn.microsoft.com/en-us/library/ee794689.aspx

Note that I did this with TFS 2013, but it works back as far as 2010 at least.

Upvotes: 1

Dylan Smith
Dylan Smith

Reputation: 22255

The build number is set using the build number template that you specify in the Build Definition. When editing your Build Definition go to the Process tab -> Build Number Format field and you can customize what you want the build numbers to look like.

The default format is: $(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)

Which will give you a build number comprsied of your Build Definition Name, the current date, and a numeric revision on the end to ensure uniqueness.

Upvotes: 1

Related Questions