使用 Windows 凭据以编程方式登录 TFS
Login TFS programmatically using Windows Credentials
我目前正在尝试登录我的 TFS,无需硬编码或通过控制台或文本框提供凭据。
原因是 Programm 将成为夜间构建过程的一部分,因此应尽可能使用当前登录计算机 运行 Programm 的用户。
我完全不知道如何解决这个问题。
我目前的方法如上所述
tfs = new TfsTeamProjectCollection(new Uri("myTfsServer"), new System.Net.NetworkCredential(username, password));
哪里应该更像。
tfs = new TfsTeamProjectCollection(new Uri("myTfsServer"), System.Windows.GetCurrentNetworkCredentials);
到目前为止我还没有找到任何东西。
你应该尝试这样的事情:
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri("http://__xxx__tfs:8080/tfs/__xxx__"));
tpc.EnsureAuthenticated();
我目前正在尝试登录我的 TFS,无需硬编码或通过控制台或文本框提供凭据。
原因是 Programm 将成为夜间构建过程的一部分,因此应尽可能使用当前登录计算机 运行 Programm 的用户。
我完全不知道如何解决这个问题。 我目前的方法如上所述
tfs = new TfsTeamProjectCollection(new Uri("myTfsServer"), new System.Net.NetworkCredential(username, password));
哪里应该更像。
tfs = new TfsTeamProjectCollection(new Uri("myTfsServer"), System.Windows.GetCurrentNetworkCredentials);
到目前为止我还没有找到任何东西。
你应该尝试这样的事情:
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri("http://__xxx__tfs:8080/tfs/__xxx__"));
tpc.EnsureAuthenticated();