.net - 采用 ICredentialsProvider 的 TfsTeamProjectCollectionFactory.GetTeamProjectCollection 的替代方案

标签 .net tfs sdk tfs-sdk

根据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/

相关文章:

c# - 数据访问层(DAL)中的LINQ查询方法

.net - Windows 身份验证 - .NET Core Angular 应用程序

c# - 无法构建其中包含 processTemplate.xaml 的项目

c# - TFS 2010 : Is it possible to use a list of key value pairs in the ProcessParameterMetadataCollection?

android - Android 应用程序中的 Facebook SDK

ios - Xcode 6 中缺少基本 SDK

.net - 交易和ASP.NET成员资格API

c# - 在csproj中使用appdata环境变量

visual-studio-2010 - 如何在 Visual Studio 中轻松识别同一代码库的不同分支?

java - 安装 Android SDK Build-Tools 26 后无法启动 Activity ComponentInfo{...}