任何人都可以帮助我如何将一组文件(尤其是 *.dll 文件)从本地文件夹中检入到 TFS 中将此构建的输出更新到 TFS 中的公共程序集文件夹。这些程序集由各种应用程序使用。这里我们使用 TFS 2010 构建定义进行构建自动化。
问问题
1653 次
1 回答
1
我已经通过下面的代码弄清楚了......
TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri(tfsName));
// Get a reference to Version Control.
VersionControlServer versionControl = tfs.GetService<VersionControlServer>();
Workspace workspace =
versionControl.CreateWorkspace("TempWorkSpace1", versionControl.AuthorizedUser);
// Create a mapping using the Team Project supplied on the command line.
workspace.Map(tfsPath, path);
context.WriteBuildMessage("Sucessfully mapped to the folder " + path,
BuildMessageImportance.High);
// Get the files from the repository.
workspace.Get();
context.WriteBuildMessage("Sucessfully get the binaries from workspace",
BuildMessageImportance.High);
String files = tfsPath + "/*";
context.WriteBuildMessage(
"Temporarily checking out the files from tfs path " + files,
BuildMessageImportance.High);
int pendedit = workspace.PendEdit(files, RecursionType.Full);
PendingChange[] pendingchanges = workspace.GetPendingChanges();
context.WriteBuildMessage(
"Copying all the binaries from the DropLocation- " +
buildInformation.DropLocation,
BuildMessageImportance.High);
CopyAllFiles(buildInformation.DropLocation, path, false);
context.WriteBuildMessage("Copied all the binaries from the DropLocation",
BuildMessageImportance.High);
WorkspaceCheckInParameters parameters =
new WorkspaceCheckInParameters(pendingchanges, "***NO_CI***")
{
OverrideGatedCheckIn = true,
};
int changeset = workspace.CheckIn(parameters);
context.WriteBuildMessage("Checking in all the files to workspace - " + tfsPath,
BuildMessageImportance.High);
// Cleanup the workspace.
workspace.Delete();
DeleteMappedFolder();
于 2012-11-06T11:08:48.800 回答