[英]Download Files from TFS based on theirs labes using powershell
How can i find and download files from tfs based on their labels using powershell. 我如何使用Powershell根据标签从tfs查找和下载文件。 i found a code that downloads the latest version, but i want a specific labeled version. 我找到了下载最新版本的代码,但是我想要一个特定的标记版本。
You could call tf command in the powershell script to do this, the steps required to pull a label from TFS e as follows: 您可以在powershell脚本中调用tf命令来执行此操作,从TFS e提取标签所需的步骤如下:
Create the source code directory 创建源代码目录
Change the current-working directory to the source code directory The reason for this is outlined in: "Build Automation: Getting multiple labels from TFS using TF GET (without deleting the files associated with the previous TF GET)" (optional) 将当前工作目录更改为源代码目录。其原因如下:“构建自动化:使用TF GET从TFS获取多个标签(不删除与先前TF GET关联的文件)”(可选)
Delete the TFS work space if it exists aka tf workspace /delete 删除TFS工作空间(如果存在),即tf工作区/ delete
Create the TFS work space aka tf workspace /new 创建TFS工作空间aka tf工作区/ new
tf get /version:L<label name> /noprompt
从TFS aka tf get /version:L<label name> /noprompt
标签, tf get /version:L<label name> /noprompt
Detail code please refer this blog: How to Correctly pull labels from TFS using PowerShell 详细代码请参考此博客: 如何使用PowerShell从TFS正确提取标签
Another way is using TFS API, instead of directly get latest, you could use a VersionSpec to specify which version you want. 另一种方法是使用TFS API,而不是直接获取最新版本,而可以使用VersionSpec来指定所需的版本。 Such as a DateVersionSpec, a ChangeVersionSet or a LabelVersionSet. 例如DateVersionSpec,ChangeVersionSet或LabelVersionSet。 Detail code please refer How to use the TFS API to retrieve a historical version of your project , you could - involve TFS API in PowerShell. 详细代码,请参阅如何使用TFS API检索项目的历史版本 ,您可以-在PowerShell中使用TFS API 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.