Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS and msbuild version number with last changeset

I want to create a build number which looks like Major.minor.Date.LastChangeSetInTFS, the problem is how to get last changeset number from the TFS. Is there any property, or something??

like image 851
Leszek Wachowicz Avatar asked Oct 27 '09 13:10

Leszek Wachowicz


3 Answers

OK finally I've found a solution. Here's a task that will provide you the latest changeset number and create a property to insert it in an Assembly info build number. The main problem was in the missing TfsLibraryLocation property (without it, it should be pointing to libraries in GAC, but it didn't)

<Target Name="GetVersionChangeSet">
<TfsVersion
  TfsLibraryLocation="C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies"      
  LocalPath="$(SolutionRoot)">
  <Output TaskParameter="Changeset" PropertyName="ChangesetNumber"/>
</TfsVersion>
<Message Text="TFS ChangeSetNumber: $(ChangesetNumber)" />

like image 109
Leszek Wachowicz Avatar answered Nov 18 '22 16:11

Leszek Wachowicz


According to a comment on this page you can use the command line tf changeset /latest /i but I can't verify that from home.

like image 32
stuartd Avatar answered Nov 18 '22 15:11

stuartd


Sorry, I cannot comment on the latest answer.

The TfsVersion task in the form you provided will only give you the latest changeset number in the $(SolutionRoot).

If you have something newer in $(SolutionRoot)\subdir, the provided solution will not work, as it will give you the latest from the $(SolutionRoot), not from $(SolutionRoot)\subdir as you would have wanted.

I use the tf changeset /latest /i and it works fine for me.

like image 1
Zbigniew Kawalec Avatar answered Nov 18 '22 17:11

Zbigniew Kawalec