我正在使用 Team Foundation Server API 尝试连接到远程服务器。
在我的应用程序中,我尝试连接到 https://some-tfs-location.example.com/tfs 形式的 URL。但这样做时我收到错误 TF50309 (讨论 here )。如果我将项目集合添加到 URL 的末尾(因此路径变为 tfs/101
),那么我可以毫无问题地进行连接。
我想尝试模仿 Visual Studio 的行为,在其中我可以给它一个 URL,而无需指定项目集合,它会连接并定位项目集合。
有人对我可以使用哪些 API 来模仿 Visual Studio 行为有任何建议吗?我本来希望通过
找到项目集合TfsTeamProjectCollection ttpc = new TfsTeamProjectCollection(projectRoot.ServerUrl,new MyCredentials());
var projectCollection = ttpc.CatalogNode.FullPath;
但这会导致相同的 TF50309 错误代码。
最佳答案
您可以使用TfsConfigurationServer具有没有团队项目集合的服务器 Uri 的类(例如 http://localhost:8080/tfs ),获取 ITeamProjectCollectionService服务,并使用 GetCollections 方法或 GetDefaultCollection 方法检索所需的集合。
这个blog post更详细地描述了它。
关于tfs - 检测 Team Foundation Server 2010 中的团队项目集合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8120060/