20
votes

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?

3
In what way would the changeset number be used for deployment?John Saunders
I want to use it for the deploy path: /p:DeployIisAppPath=/changeset/CHANGESETNUMBERKonrad

3 Answers

28
votes

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.

10
votes

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.

0
votes

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.