workspace.PendAdd() 确切的语法吗?

发布于 2024-11-17 19:00:35 字数 170 浏览 4 评论 0原文

我无法使用 tfs sdk 添加新文件:

 int a = workspace.PendAdd(path,recursive );

这个参数“路径”是什么?文件路径 在哪里添加或从哪里添加?

或者在使用此方法之前必须将新文件复制到此文件夹中?

I am unable to add a new file using tfs sdk:

 int a = workspace.PendAdd(path,recursive );

What is this argument "Path"? path of file where to add or from where to add?

or before using this method v have to copy the new file in this folder?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光清浅 2024-11-24 19:00:35

如果您尝试添加文件夹,则该目录必须首先存在。如果您尝试添加文件,该文件必须首先存在。之后,您可以运行,例如:

TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer("http://WhateverServerUrl");
VersionControlServer VsServer = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
Workspace ws = VsServer.GetWorkspace("WORKSPACE_NAME", "WORKSPACE_OWNER");
ws.PendAdd(@"C:\MyFolder", true);

请记住,如果您实际上正在创建文件夹,则该命令的身份执行需要具有创建文件夹的权限。

因此,要创建一个文件夹,您当然必须添加代码来假设它尚不存在:

System.IO.Directory.CreateDirectory(@"C:\MyFolder");

If you are trying to add a folder, the directory has to exist first. If you are trying to add a file, the file has to exist first. After that you can run, for example:

TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer("http://WhateverServerUrl");
VersionControlServer VsServer = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
Workspace ws = VsServer.GetWorkspace("WORKSPACE_NAME", "WORKSPACE_OWNER");
ws.PendAdd(@"C:\MyFolder", true);

Keep in mind that the identity exec this command needs to have permissions to create the folder if in fact you are creating a folder.

So to create a folder though of course you would have to add code to do assuming it doesn't already exist:

System.IO.Directory.CreateDirectory(@"C:\MyFolder");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文