I am attempting to get the latest changeset version in a TFS MSBuild. I have tried a number of solutions, and have referenced TFS and msbuild version number with last changeset without the desired result. Any other ideas?
- Some blog entries/examples suggest using 'tf changeset /latest /i msbuild', however I cannot find documentation on how to get the desired value into a property inside an MSBuild xml file. 
- Other examples suggest using the msbuild extension pack, however the documentation is not complete, and the 'changesets' property below appears to be empty. 
Refer to: http://social.msdn.microsoft.com/Forums/en/msbuild/thread/3fd46d76-2544-4818-b504-0fa2fc1e5c6a
    <MSBuild.ExtensionPack.Tfs.TeamBuild TaskAction="RelatedChangesets" TeamFoundationServerUrl="$(TeamFoundationServerUrl)" TeamProject="$(TeamProject)" BuildUri="$(BuildUri)" BuildDefinitionName="$(BuildDefinitionName)">
   <Output ItemName="changesets" TaskParameter="RelatedItems"/>
  </MSBuild.ExtensionPack.Tfs.TeamBuild>
  <Message Text="ID = %(Changesets.Identity), Checked In By = %(Changesets.CheckedInBy), URI = %(Changesets.ChangesetUri), Comment = %(Changesets.Comment)"/>
This Produces: Task "Message" "ID = , Checked In By = , URI = , Comment = "
It has also been suggested I use the following after the teambuild task above, but again since the 'changesets' property is empty, I get an error:
Refer to: http://social.msdn.microsoft.com/Forums/en/msbuild/thread/9ac51ffe-137f-4d55-87e1-6fbbc401aab1
    <!-- Get the last item -->
  <MSBuild.ExtensionPack.Framework.MsBuildHelper TaskAction="GetLastItem" InputItems1="@(changesets)">
   <Output TaskParameter="OutputItems" 开发者_StackOverflowItemName="LastItem"/>
  </MSBuild.ExtensionPack.Framework.MsBuildHelper>
  <Message Text="Last Item: %(LastItem.Identity)"/>
edit: correct code and add reference links
If you were using Team Build 2010, you could use BuildDetail.SourceGetVersion. This simply give you changeset number.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论