誰かがファイルのセット(特に* .dllファイル)をローカルにマップされていないローカルフォルダーからTFSにチェックインする方法を教えてもらえますか?実際、ビルドがビルドサーバーで作成されると、プロジェクトのセットが必要になりますこのビルドの出力をTFSの共通のアセンブリフォルダーに更新します。このアセンブリがさまざまなアプリケーションで使用される場所。ここでは、ビルドの自動化にTFS2010ビルド定義を使用しています。
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 に答える