如何通过TFS API获取最新的更改集编号

如何通过TFS API获取最新的更改集号? 你能举个例子吗?

干得好:

TeamProjectPicker tpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, true); tpp.ShowDialog(); var tpc = tpp.SelectedTeamProjectCollection; VersionControlServer versionControl = tpc.GetService(); var tp = versionControl.GetTeamProject("MyTeamProject"); var path = tp.ServerItem; var q = versionControl.QueryHistory(path, VersionSpec.Latest, 0, RecursionType.Full, null, VersionSpec.Latest, VersionSpec.Latest, Int32.MaxValue, true, true, false, false); Changeset latest = q.Cast().First(); // The number of the changeset int id = latest.ChangesetId; 

使用TeamProject的VersionControl中的路径调用QueryHistory,我们想要从最新的变更集到最新的变更集,在你的情况下,剩下的一大堆参数都是默认的。