首页 > 解决方案 > 使用 tf.exe 从现有标签创建新标签

问题描述

在 Visual Studio 中,可以从与现有标签关联的文件中创建新的源代码管理标签。

我将如何在 Powershell 脚本中使用tf.exe?

标签: powershelltfs

解决方案


这可以通过命令 /version上的参数来实现。tf.exe label

文档说明/version参数的格式应为 L 后跟标签名称:

# Create an alias to tf.exe
Set-Alias tf "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\tf.exe"

$labelName = "New label"
$labelComment = "Comment on new label"
$previousLabelName = "Nightly Build"
$sourceFolder = "C:\Folder\Containing Source\"

tf label $labelName $sourceFolder /comment:$labelComment /version:L$previousLabelName /recursive /child:Replace

推荐阅读