Dot-Net
替代 TfsTeamProjectCollectionFactory.GetTeamProjectCollection 採用 ICredentialsProvider
根據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,但是如果我們想要憑證的備份機制,從現在開始應該使用什麼?謝謝
您需要使用新的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);