使用 TFS API 将代码签入 TFS 服务器 [英] Check-in code into TFS Server by using TFS API
本文介绍了使用 TFS API 将代码签入 TFS 服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写 C# 代码来将代码签入到 TFS 服务器:
I'm writing c# code to check-in code to TFS server:
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 下的所有文件/文件夹都是Pending Change".
"No files checked in", all files/folders under LocalWorkingPath are "Pending Change".
以上代码是否正确?
推荐答案
我将命令 WS.GetPendingChanges() 更改为 WS.GetPendingChanges(tfsServerFolderPath,RecursionType.Full) 并且它在我身边工作.
I changed the command WS.GetPendingChanges() to WS.GetPendingChanges(tfsServerFolderPath,RecursionType.Full) and it is working at my side.
详情如下:
//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.");
这篇关于使用 TFS API 将代码签入 TFS 服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文