I have a release definition containing the following environments:
I would like to create a label in TFS Source control whenever a deployment to PRODUCTION is made. Something like "LIVE [Date] - Changeset [n]"
Is this possible?
The simplest way to accomplish this is to run a command line:
tf vc label labelname[@scope] [/owner:ownername] itemspec
[/version:versionspec] [/comment:("comment"|@commentfile)]
[/child:(replace|merge)] [/recursive] [/login:username,[password]]
[/collection:TeamProjectCollectionUrl]
The safest way to call tf is by using vswhere to locate Visual Studio 2017 and then homing in on tf.exe. Or you can call into tf.exe that ships with the agent (officially unsupported).
By using the server side item spec format ($/project/
) you can apply the label without first mapping a local workspace.
If your Build Defintion was using the Project Ccollection scope, you may have to use the @scope
option ("My label@$/Project"
) to make sure the label is created at the right level.