你如何连接到使用特定凭证在C#中的TFS服务器? [英] How do you connect to a TFS server in C# using specific credentials?

查看:667
本文介绍了你如何连接到使用特定凭证在C#中的TFS服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图写连接到TFS和检索工作项目信息的C#应用​​程序。不幸的是,它似乎像使用TFS SDK的所有例子都使用当前用户(即我的域名注册信息)的默认凭据。我发现的最接近的一条信息是使用 TeamFoundationServer(字符串,ICredentials)的构造函数,但是我无法找到,与<$ C $接口一个合适的类的任何信息C> ICredentials 界面(特别是因为它似乎不使用System.Net ICredentials但TeamFoundationServer具体ICredentials进行)。

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).

有没有人有登录到TFS与特定的用户名/密码/域组合的任何见解?

Does anyone have any insight for logging into TFS with a specific username/password/domain combination?

推荐答案

以下code可以帮助你:

The following code should help you:

NetworkCredential cred = new NetworkCredential("Username", "Password", "Domain");
tfs = new TeamFoundationServer("http://tfs:8080/tfs", cred);
tfs.EnsureAuthenticated();

域可以是实际的域或工作组中的情况下,这将是承载TFS应用层的服务器的名称。

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.

这篇关于你如何连接到使用特定凭证在C#中的TFS服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆