Konrad
Konrad

Reputation: 4762

TFS Build specific changeset and deploy it using the changeset number

I have a Build Definition to build a solution on my TFS. This works well, but it always builds the latest version.

  1. How can I force to build a specific changeset from the past?

  2. How can I use/pass this number to the "MSBuild Arguments" to use it there for deployment?

Upvotes: 21

Views: 13574

Answers (3)

pantelif
pantelif

Reputation: 8544

The answer to your first question is clearly what @Dylan has stated.

To your second part:
The important argument is GetVersion. Navigate to activity "Run MSBuild for Project" within your Build Process Template, by default this has a value CommandLineArguments equal to

String.Format("/p:SkipInvalidConfigurations=true {0}", MSBuildArguments)

You can change it to something like

String.Format("/p:SkipInvalidConfigurations=true {0} /p:DeployIisAppPath=/changeset/{1}", MSBuildArguments, GetVersion)

and get where you need to go.

Upvotes: 10

John Saunders
John Saunders

Reputation: 161773

If you use the changeset number, then it will only make sense for CI builds, since they typically build a single changeset.

For any other kind of build, I recommend using the build ID, which is unique, and covers the case of a build that builds multiple changesets.

Upvotes: 0

Dylan Smith
Dylan Smith

Reputation: 22235

When you queue up the build from Team Explorer, in the Parameters tab one of the Advanced arguments is get version.

Note: I think you need to specify this in the form C123 where 123 is the changeset number.

Upvotes: 28

Related Questions