使用 TFS API 将代码签入 TFS 服务器

2023-11-30

我正在编写 C# 代码来将代码签入 TFS 服务器:

Workspace WS = VersionControl.GetWorkspace(TeamProject);
WS.Map(TFSMapServerPath,LocalWorkingPath);

int NumberOfChange = WS.PendAdd(string.Format(@"{0}\Main\DotNet\",LocalWorkingPath),true);

PendingChange[] pendingChanges = WS.GetPendingChanges();        
WS.CheckIn(pendingChanges,"Auto Check-in");

但我得到的错误是

“没有签入文件”,LocalWorkingPath 下的所有文件/文件夹均为“待更改”。

上面的代码正确吗?


我将命令 WS.GetPendingChanges() 更改为 WS.GetPendingChanges(tfsServerFolderPath,RecursionType.Full) 并且它在我身边工作。

这是详细信息:

        //Get the current workspace
        WS = versionControl.GetWorkspace(workspaceName, versionControl.AuthorizedUser);     

        //Mapping TFS Server and code generated
        WS.Map(tfsServerFolderPath,localWorkingPath);

        //Add all files just created to pending change
        int NumberOfChange = WS.PendAdd(localWorkingPath,true);
        //Get the list of pending changes
        PendingChange[] pendings = WS.GetPendingChanges(tfsServerFolderPath,RecursionType.Full);

        //Auto check in code to Server
        WS.CheckIn(pendings,"CodeSmith Generator - Auto check-in code.");
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 TFS API 将代码签入 TFS 服务器 的相关文章

随机推荐