根据MSDN TfsTeamProjectCollectionFactory
类的方法 GetTeamProjectCollection(RegisteredProjectCollection projectCollection, ICredentialsProviderfallbackCredentialsProvider
现已弃用:
“注意:此 API 现已过时。”
[ObsoleteAttribute("此方法已被弃用,并将在未来版本中删除。请参阅 GetTeamProjectCollection(RegisteredProjectCollection)。", false)]
建议使用仅采用RegisteredProjectCollection
的重载,但是如果我们想要凭证的回退机制,从现在开始我们应该使用什么?
谢谢
最佳答案
您需要使用新的 TfsTeamProjectCollection constructor伴随着这个TfsClientCredentials constructor它允许交互式提示进行身份验证。
// 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);
关于.net - 采用 ICredentialsProvider 的 TfsTeamProjectCollectionFactory.GetTeamProjectCollection 的替代方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14107842/