How to: Make Team Build get a previous version

Grant Holliday’s blog

Service Engineer, Microsoft Visual Studio Online - Team Foundation Server

How to: Make Team Build get a previous version

  • Comments 8

In Team Build 2008 there is a property called GetVersion. Here’s what the description from Aaron Hallberg’s blog says about it:

GetVersion.  Passed to the Version property of the Get task.  Defaults to SourceGetVersion (see below), but can be overridden to retrieve a particular version from source control.






To use this property to build a previous version of the source code you have three options:

Additional MSBuild Parameters dialog

Queue a new build and in the "Additional MSBuild Parameters" box, put:


Where XXXX is the changeset you want to build. See screenshots here.

TFSBuild.rsp – MSBuild Response file

Or, put the same option in the TFSBuild.rsp (response) file. The contents of this file are passed as command line parameters to MSBuild.



Or, Add a property into the TFSBuild.proj Team Build project file.






You don’t have to specify a changeset either. You can specify any valid versionspec. See the versionspec heading under Command-Line Syntax for more options.

With TFS 2005 you would have needed to change the core implementation of Team Build.
See Aaron Hallberg's "Building a Specific Version with Team Build" blog.



Another thing to keep in mind is – What version of TFSBuild.proj will you be using to build the previous version of the code? What I typically do is store the TFSBuild.proj file alongside the source code in the branch. That way when you branch the code and you need to make build script changes, they are isolated and merged back with the code changes.
  • PingBack from

  • How Do I: Use the Checksum and ExpectedSchema Database Test Conditions Tommy Norman on TFS API: Work...

  • 关键字:Label,Changeset,datetime...在TeamBuild的时候我们经常有需求需要编译某个版本,例如某个Label,或者什么时候提交的,而不是最新提交的版本,在T...

  • How about an updated post about this for Team Build 2010?  I can see the GetVersion parameter on the Queue Build parameters tab, but it doesn't seem like it works.  The build still says "triggered by...changeset..xxxx" which is the most recent even when I specify an older changeset.

  • Try creating a shelveset from that changeset and then specifying that shelveset in the build definition or build dialog (as oppossed to 'latest').

  • brotherjay is right. an updated post for Team Build 2010 would be very nice. Does anyone know how that works?

    I also tried this Get Version option in my Build Definition ->Process->3.Advanced->MSBuildArguments:/p:GetVersion=CXXXX, but this didn't work. Same for Queue Build->Tab Parameters->2.Advanced->MSBuildArguments:/p:GetVersion=CXXXX

    Any known solution?

  • Is there any chance to get more than one changeset at a time? i mean getting the changeset numbers: C3122,C3123,C3515.

  • The property override actually does not work and never has:

Page 1 of 1 (8 items)