【发布时间】:2018-07-23 21:00:57
【问题描述】:
我需要获取未映射到我的计算机上的 TFS 工作区的最新版本。
这是我的代码:
using (TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(
new Uri("http://tfs:8080/tfs/project"),
new NetworkCredential("tfs", "pwd")))
{
tfs.EnsureAuthenticated();
VersionControlServer vcs = tfs.GetService<VersionControlServer>();
Workspace w = vcs.GetWorkspace("VM-TFS", vcs.AuthorizedUser);
// Implement w.Get(.....)
}
问题是在GetWorkspace() 上我收到了一个异常:"TF14061: the workspace VM-TFS;DELTA\\tfs does not exist."(其中用户名之前的'DELTA' 是我们的域。)
我确定用户名是正确的,他是工作区的所有者,工作区的名称也是正确的。
更新
我发现了问题。最初,我使用智能感知直接导入了 .dll。通过这种方式,我认为 Visual Studio 引用了他附带的 dll。 我尝试删除所有这些并使用 NuGet 安装“Microsoft.TeamFoundationServer.ExtendedClient”,现在它可以工作了!
【问题讨论】:
-
您是否尝试获取所有个工作区的列表并查看返回的结果?
-
你的意思是API代码?因为我没有找到办法……