Search This Blog

Thursday, December 28, 2006

Get Build Changes (ChangeSetData, Changeset, Change)

To improve our custom build report that I have talked about before (Custom Build Logger) I wanted to add information regarding the users that are involved in this build and the changes that they made to source control.
Here's an example how to go over build changes:


using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.VersionControl.Client;
using Microsoft.TeamFoundation.Build.Proxy;

TeamFoundationServer tfs = new TeamFoundationServer(server);
VersionControlServer vcs = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
BuildStore bs = (BuildStore)tfs.GetService(typeof(BuildStore));
ChangeSetData[] changeSetsData = bs.GetChangeSetsForBuild(bs.GetBuildUri(project, buildNumber));
foreach (ChangeSetData changeSetData in changeSetsData)
{
//Here you can do something with the ChangeSetData properties
//changeSetData.CheckedInBy...
//Get the ChangeSetData Changeset
Changeset changeSet = vcs.GetChangeset(changeSetData.ChangeSetId);
//Go over the Changeset changes
foreach (Change change in changeSet.Changes)
{
//Here you can do something with the Change
//change.Item.ServerItem...
}
}

2 comments:

jeremy said...

how does this work now that BuildStore is obselete

electronic signature software said...

Hey , thanks for posting details on Get Build Changes. how does it work. Here what are the meaning of attributes ChangeSetData, Changeset, Change that you passed in it ??