I am attempting to get the latest changeset version in a TFS MSBuild. I have tried a number of solutions, and have referenced http://stackoverflow.com/questions/1630823/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" ItemName="LastItem"/>
</MSBuild.ExtensionPack.Framework.MsBuildHelper>
<Message Text="Last Item: %(LastItem.Identity)"/>
edit: correct code and add reference links