2

如何从代码中退出 TFS 2012(云)?

尝试了一些东西,但身份提供者总是加载相同的凭据。

更新: 我已经尝试过的一些代码

ClientCredentials tfsClientCredentials = new TfsClientCredentials(false);
TfsConfigurationServer serverConfig = new TfsConfigurationServer(uri, tfsClientCredentials);
serverConfig.EnsureAuthenticated();

和第二个片段

TfsConfigurationServer serverConfig = new TfsConfigurationServer(uri, new UICredentialsProvider());
serverConfig.EnsureAuthenticated();

第三个

ICredentialsProvider provider = new UICredentialsProvider();
WindowsCredential wcred = new WindowsCredential(cred, provider);
TfsClientCredentials tfsClientCredentials = new TfsClientCredentials(wcred);
TfsConfigurationServer serverConfig = new TfsConfigurationServer(uri, tfsClientCredentials);
serverConfig.EnsureAuthenticated();
4

0 回答 0