【发布时间】:2019-04-03 17:03:49
【问题描述】:
我已安装 Visual Studio PowerTools,并正在尝试下载与每个变更集关联的物理文件。
我可以通过执行以下操作找到与文件关联的所有变更集并下载该文件的最新版本:
$tfsServer = Get-TFSServer 'http://myserver/tfs'
$history = Get-TfsItemHistory -HistoryItem $tfsHistoryItem -Server $tfsServer
$tfsProjColl = Get-TfsProjectCollection -Uri $tfsRootUrl
$tfsVersionControl = $tfsProjColl.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer])
foreach ($h in $history)
{
$tempFilePath = [System.IO.Path]::GetTempFileName()
$item = Get-TfsItemProperty -Item $h -Server $tfsServer
$tfsVersionControl.DownloadFile($item.SourceServerItem, $tempFilePath)
}
起初,我以为我拥有它,但 SourceServerItem 只是对同一文件的引用,它是最新的。如何下载当时检查的文件版本?
【问题讨论】:
-
我需要尝试一下,但您几乎可以肯定必须使用 VersionControlServer.DownloadFile Method (String, Int32, VersionSpec, String) 在其中指定特定的 VersionSpec(可能是 ChangeSetVersionSpec)你想要的版本
-
我确实有那个下载部分。我只是不知道如何找到文件的每个版本。
标签: powershell tfs