9

根据MSDNGetTeamProjectCollection(RegisteredProjectCollection projectCollection, ICredentialsProvider fallbackCredentialsProvider,该类的方法TfsTeamProjectCollectionFactory现在已弃用:

  • “注意:此 API 现在已过时。”

  • [ObsoleteAttribute("This method has been deprecated and will be removed in a future release. See GetTeamProjectCollection(RegisteredProjectCollection) instead.", false)]

建议是使用只接受 的重载RegisteredProjectCollection,但是如果我们想要凭证的后备机制,从现在开始应该使用什么?

谢谢

4

1 回答 1

12

您需要使用新的TfsTeamProjectCollection 构造函数以及此TfsClientCredentials 构造函数,该构造函数允许交互式提示进行身份验证。

// Use default windows credentials, and if they fail, AllowInteractive=true
var tfsCreds = new TfsClientCredentials(new WindowsCredential(), true);

TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(
    new Uri("http://yourserver:8080/tfs/DefaultCollection"),
    tfsCreds);
于 2013-02-01T10:59:21.267 回答