1
ITeamFoundationContextManager tfContextManager = ServiceProvider.GlobalProvider.GetService(typeof(ITeamFoundationContextManager)) as ITeamFoundationContextManager;
tfContextManager.SetContext(teamProjectCollection, projectUri);

此代码不起作用。请

4

1 回答 1

0

我不是 100% 确定你在这里问什么,但我已经完成了一些使用 SDK 连接到 TFS 的代码,这可能对你有帮助:

 private TfsTeamProjectCollection tfsServer = null;
 private VersionControlServer vcsServer = null;

 // This code is in a connection method
 tfsServer = new TfsTeamProjectCollection(new Uri (pServerName));
 tfsServer.EnsureAuthenticated();
vcsServer = (VersionControlServer)tfsServer.GetService(typeof(VersionControlServer));

然后,您可以使用以下命令提取团队项目集合:

// attempt to extract a list of all projects

TeamProject[] projects = vcsServer.GetAllTeamProjects(true);

// add each one in turn to the list

foreach (TeamProject currentProject in projects)
{

}
于 2013-05-24T07:33:28.320 回答