I am trying to create a new branch using the API, and have used both PendBranch()
and CreateBranch()
. The problem with CreateBranch()
In TFS changeset comments are actually editable. Therefore you could try something like the following that makes use of the CreateBranch method introduced in VS2008/TFS2008 SP1:
public void CreateBranchWithComment(
string serverUrl,
string sourcePath,
string targetPath,
string comment)
{
TeamFoundationServer tfs = new TeamFoundationServer(serverUrl);
VersionControlServer vcServer =
(VersionControlServer)tfs.GetService(typeof(VersionControlServer));
int changesetId = vcServer.CreateBranch(
sourcePath,
targetPath,
VersionSpec.Latest);
Changeset changeset = vcServer.GetChangeset(changesetId);
changeset.Comment = comment;
changeset.Update();
}