开发者

workspace.PendAdd() exact syntax?

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

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

What is this argument "Path"? p开发者_高级运维ath 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?


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");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜