Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用GETWorkStudio连接到Team Foundation服务器工作区 我是Team Foundation Server的新手,我尝试用C语言编程连接到一个项目。我有以下代码块 string serverName = "http://tfs01:8080"; TeamFoundationServer tfs = new TeamFoundationServer(serverName); VersionControlServer version = (VersionControlServer)tfs.GetService(typeof (VersionControlServer)); Workspace workspace = version.GetWorkspace("Test", version.AuthenticatedUser); MessageBox.Show(workspace.Name);_C#_Version Control_Tfs_Workspace - Fatal编程技术网

C# 使用GETWorkStudio连接到Team Foundation服务器工作区 我是Team Foundation Server的新手,我尝试用C语言编程连接到一个项目。我有以下代码块 string serverName = "http://tfs01:8080"; TeamFoundationServer tfs = new TeamFoundationServer(serverName); VersionControlServer version = (VersionControlServer)tfs.GetService(typeof (VersionControlServer)); Workspace workspace = version.GetWorkspace("Test", version.AuthenticatedUser); MessageBox.Show(workspace.Name);

C# 使用GETWorkStudio连接到Team Foundation服务器工作区 我是Team Foundation Server的新手,我尝试用C语言编程连接到一个项目。我有以下代码块 string serverName = "http://tfs01:8080"; TeamFoundationServer tfs = new TeamFoundationServer(serverName); VersionControlServer version = (VersionControlServer)tfs.GetService(typeof (VersionControlServer)); Workspace workspace = version.GetWorkspace("Test", version.AuthenticatedUser); MessageBox.Show(workspace.Name);,c#,version-control,tfs,workspace,C#,Version Control,Tfs,Workspace,当我执行代码时,我收到以下错误 TF14061: The workspace Test;vercuskis does not exist. “Test”项目不在根目录下,可以从VS2008团队资源管理器中访问,我确实可以安全访问它,我可以使用它签入和签出代码 我不确定代码中是否正确引用了“测试”项目。我正在寻找一个如何从TFS根引用项目名称的示例 谢谢,问题是上面代码中的“测试”指的是TFS工作区,而不是TFS中的项目。TFS使用一种称为工作区的思想,您可以将目录和项目映射到该工作区 您正在使

当我执行代码时,我收到以下错误

TF14061: The workspace Test;vercuskis does not exist.
“Test”项目不在根目录下,可以从VS2008团队资源管理器中访问,我确实可以安全访问它,我可以使用它签入和签出代码

我不确定代码中是否正确引用了“测试”项目。我正在寻找一个如何从TFS根引用项目名称的示例

谢谢,

问题是上面代码中的“测试”指的是TFS工作区,而不是TFS中的项目。TFS使用一种称为工作区的思想,您可以将目录和项目映射到该工作区

您正在使用的工作区显示在源代码管理资源管理器windwo的顶部。上面写着:“Workspace:”然后是您正在使用的工作区的名称

以下是一个关于工作区的好资源:


然后,您可能还需要从TFS获取一些文件夹映射。TFS文档很少,我用它做的很多工作都需要反复尝试才能理解TFS是如何工作的,以及API与在visual studio中使用源代码管理资源管理器有何不同。

正如Brian所说,您对什么是工作区感到困惑。他的链接很好:

如果您只想查询有关版本控制系统的历史信息,而不签入/签出任何文件,则根本不需要工作区。只需使用VersionControlServer对象

  • QueryItems=“tf dir”
  • queryItemsExtend=“tf属性”
  • QueryPendingChanges=“tf状态”
  • QueryHistory=“tf history”--注意,枚举会通过产生返回导致额外的服务器往返
  • 等等

    • 我也有同样的问题,我相信这是因为VS的工作区映射了多个项目。因此,我创建了一个新的工作区,其中只有一个映射项目

      我的解决方案: 从VS打开命令 运行以下行:
      tf workspace/new/s:http://tfs2010.server.com:8080/tfs

      像这样:

      C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>tf workspace /new /s:http://tfs2010.server.com:8080/tfs
      
      系统将提示您设置新工作区: 名称:您喜欢的工作区名称(无空格或特殊字符) 源代码管理文件夹:
      $/FolderName
      本地文件夹:
      C:\FolderName

      在代码中使用输入的工作区名称

          this._server = config.GetAttribute("server");
          **this._workspace = config.GetAttribute("workspace");**
          this._user = config.GetAttribute("user");
          this._password = config.GetAttribute("psw");
          TeamFoundationServer tfs = new TeamFoundationServer(this._server, new System.Net.NetworkCredential(this._user, this._password));
          tfs.Authenticate();
          VersionControlServer versionControl = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
          Workspace ws = versionControl.GetWorkspace(this._workspace, this._user);
      

      啊,好的,我明白了。。。那么我想这不是我要找的工作空间。我想连接到该项目并查看该项目源代码管理中的所有项。我猜我必须查询TeamFoundationServer对象才能进入其中。