按照MSDN的方法GetTeamProjectCollection(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,但是如果我们想要凭证的回退机制,我们应该从现在开始使用什么?
谢谢
Gra*_*day 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);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5848 次 |
| 最近记录: |