在TFS 2010上进行身份验证

Key*_*nan 9 tfs tfs2010

我在MS Team Foundation Server上作为特定用户进行身份验证时遇到问题.在旧版本中,它看起来像:

teamFoundationCredential = new System.Net.NetworkCredential("<USERNAME>", "<PASSWORD>", "<DOMAIN>");

TeamFoundationServer tfs = new TeamFoundationServer("http://mars:8080/", teamFoundationCredential);
Run Code Online (Sandbox Code Playgroud)

有人可以告诉我2010版本的等效产品.到目前为止,我有:

ICredentialsProvider cred = null;

tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://asebeast.cpsc.ucalgar.ca:8080/tfs/DefualtCollection"));

tfs.EnsureAuthenticated();
Run Code Online (Sandbox Code Playgroud)

谢谢

Dmy*_*roL 13

对于TFS 2010,请使用以下内容:

TfsTeamProjectCollection collection = new TfsTeamProjectCollection(
        new Uri("http://asebeast.cpsc.ucalgar.ca:8080/tfs/DefaultCollection",
        new System.Net.NetworkCredential("domain_name\\user_name", "pwd"));
collection.EnsureAuthenticated();
Run Code Online (Sandbox Code Playgroud)