检测 Team Foundation Server 2010 中的团队项目集合
我正在使用 Team Foundation Server API 尝试连接到远程服务器。
在我的应用程序中,我尝试连接到以下形式的 URL https://some-tfs- location.example.com/tfs 但这样做时我收到错误 TF50309 (讨论了 此处)。如果我将项目集合添加到 URL 的末尾(因此路径变为 tfs/101
),那么我可以毫无问题地进行连接。
我想尝试模仿 Visual Studio 的行为,在其中我可以给它一个 URL,而无需指定项目集合,它会连接并定位项目集合。
有人对我可以使用哪些 API 来模仿 Visual Studio 行为有任何建议吗?我本来希望通过找到项目集合
TfsTeamProjectCollection ttpc = new TfsTeamProjectCollection(projectRoot.ServerUrl,new MyCredentials());
var projectCollection = ttpc.CatalogNode.FullPath;
但这会导致相同的 TF50309 错误代码。
I'm using the Team Foundation Server API to try to connect to a remote server.
From within my application, I try to connect to a URL of the form https://some-tfs-location.example.com/tfs but when doing so I get an error TF50309 (discussed here). If I add the project collection to the end of the URL (so the path becomes tfs/101
) then I can connect with no problems.
I'd like to try and mimic the behaviour of Visual Studio, where I can give it a URL without needing to specify the project collection and it'll connect and locate the project collection.
Does anyone have any suggestions which API's I can use to mimic the Visual Studio behaviour? I had hoped to find the project collection via
TfsTeamProjectCollection ttpc = new TfsTeamProjectCollection(projectRoot.ServerUrl,new MyCredentials());
var projectCollection = ttpc.CatalogNode.FullPath;
But this results in the same TF50309 error code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将 TfsConfigurationServer 类与服务器一起使用没有团队项目集合的 Uri(例如 http://localhost:8080/tfs),获取ITeamProjectCollectionService 服务,并使用 GetCollections方法或 GetDefaultCollection 方法来检索所需的集合。
这个博客文章 更详细地描述了它。
You can use the TfsConfigurationServer class with the server Uri that has no team project collection (e.g. http://localhost:8080/tfs), get the ITeamProjectCollectionService service, and use GetCollections method or GetDefaultCollection method to retrieve the collection you want.
This blog post described it in more details.