Created
November 14, 2013 16:41
-
-
Save JamesWoolfenden/7470026 to your computer and use it in GitHub Desktop.
How to get the TFS changeset for a build.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<PropertyGroup> | |
<AssemblyFile>.\packages\MSBuild.Extension.Pack.1.3.0\tools\net40\MSBuild.ExtensionPack.TaskFactory.PowerShell.dll</AssemblyFile> | |
</PropertyGroup> | |
<UsingTask TaskFactory="PowershellTaskFactory" TaskName="Changeset" AssemblyFile="$(AssemblyFile)"> | |
<ParameterGroup> | |
<changeset Output="true" /> | |
</ParameterGroup> | |
<Task> | |
<![CDATA[ | |
$tf = & "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\tf.exe" history . /r /noprompt /stopafter:1 /version:W | |
$changeset=$tf[2].Split(" ")[0] | |
]]> | |
</Task> | |
</UsingTask> | |
<Target Name="Build"> | |
<Changeset> | |
<Output TaskParameter="changeset" PropertyName="changeset" /> | |
</Changeset> | |
<Message Importance="High" Text="Changeset $(changeset)" /> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was trying to get TFS and teambuild to use the TFS changeset as its versioning scheme, well the hack above gets you the changeset. But you cant set your build number to reflect it (In teambuild) so it not much cop is it? (I mean we knew that already but....)
Another reason to use Teamcity.