gpt4 book ai didi

c# - 使用 TFS API 将代码 checkin TFS 服务器

转载 作者:行者123 更新时间:2023-11-30 17:01:57 25 4
gpt4 key购买 nike

我正在编写 C# 代码以将代码 checkin 到 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");

但是我得到的错误是

"No files checked in", all files/folders under LocalWorkingPath are "Pending Change".

以上代码是否正确?

最佳答案

我将命令 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.");

关于c# - 使用 TFS API 将代码 checkin TFS 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20487590/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com