如何使用特定凭据连接到 C# 中的 TFS 服务器?
我正在尝试编写连接到 TFS 并检索工作项信息的 ac# 应用程序。不幸的是,似乎所有使用 TFS SDK 的示例都使用当前用户的默认凭据(即我的域登录信息)。我发现的最接近的信息是使用 TeamFoundationServer (String, ICredentials)
构造函数,但是我找不到与 ICredentials
接口交互的合适类的任何信息(特别是因为它似乎没有使用 System.Net ICredentials,而是使用 TeamFoundationServer 特定的 ICredentials)。
有谁知道如何使用特定的用户名/密码/域组合登录 TFS?
I am attempting to write a c# application that connects to TFS and retrieves work item information. Unfortunately, it seems like all examples of using the TFS SDK are using the default credentials for the current user (i.e. my domain login information). The closest piece of information I found is to use the TeamFoundationServer (String, ICredentials)
constructor, however I cannot find any information for a suitable class that interfaces with the ICredentials
interface (especially since it seems to not be using the System.Net ICredentials but a TeamFoundationServer specific ICredentials).
Does anyone have any insight for logging into TFS with a specific username/password/domain combination?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
以下代码应该对您有帮助:
域是实际域,或者在工作组情况下,它是托管 TFS 应用程序层的服务器的名称。
The following code should help you:
Domain is either the actual domain, or in a Workgroup situation, it would be the name of the server that hosts the TFS Application Tier.
对于 TFS 2015 和2017 年,提到的对象和方法已经(或正在)被弃用。
要使用特定凭据连接到 TFS:
For TFS 2015 & 2017, objects and methods mentioned have been (or are being) deprecated.
To connect to TFS using specific credentials:
多年来,这就是使用 TFS 2013 API 的方法:
如果这不起作用,请尝试通过其他
Credential
类传递凭据(对我有用):Years down the line, this is how you do it with TFS 2013 API:
If that doesn't work, try to pass the credentials through other
Credential
classes (worked for me):