[英]Get specific version of the file from TFS
我正在嘗試通過以下代碼從TFS下載文件:
TeamFoundationServer tfsServer = new TeamFoundationServer(options.TfsUri);
VersionControlServer vcServer = (VersionControlServer)tfsServer.GetService(typeof(VersionControlServer));
if (vcServer == null)
throw new ApplicationException("Invalid vcServer");
Item i;
foreach (TFSObject obj in TfsObjectList)
{
if (!obj.isFolder)
{
i = vcServer.GetItem(obj.tfsPath);
i.DownloadFile(obj.localPath);
Console.WriteLine(obj.localPath + " is downloaded");
}
}
一切都按預期工作,但是它始終在尋找文件的最新版本。 如何獲取簽入之前或使用簽入#XXXXX簽入的文件的版本? 簽入后可以修改文件...
您的單個參數GetItem(string)
會以最新版本的指定路徑獲取Item
的信息。
您可以指定VersionSpec
來下載特定版本。 例如,要下載變更集42:
vcServer.GetItem(obj.tfsPath, new ChangesetVersionSpec(42));
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.