Get Associated Changesets from Build

Jul 25, 2013 at 3:55 PM
Hi,

I would like to get all the associated changesets from the build.
I already found out that the latest version can be retrieved by $TfsDeployerBuildDetail.SourceGetVersion.

How can get all associated test from a build?

Regards,
Fabian
Coordinator
Aug 2, 2013 at 3:07 AM
Edited Aug 2, 2013 at 3:07 AM
Hi Fabian,

Firstly, the $TfsDeployerBuildDetail object is not the original IBuildDetail from TFS but a serializable double instead. To get the original, fully-populated BuildDetail, use the TFS API from your deployment script:
Add-Type -AssemblyName 'Microsoft.TeamFoundation.Client, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Add-Type -AssemblyName 'Microsoft.TeamFoundation.Build.Client, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
$CollectionUri = 'http://localhost:8080/tfs/DefaultCollection' # change this to your collection URI
$Collection = [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection($CollectionUri)
$BuildServer = $Collection.GetService([Microsoft.TeamFoundation.Build.Client.IBuildServer])
$TfsBuildDetail = $BuildServer.GetAllBuildDetails($TfsDeployerBuildDetail.Uri)
You should then be able to query for the associated changesets:
# $TfsBuildDetail.RefreshAllDetails() # this line may or may not be needed
[Microsoft.TeamFoundation.Build.Client.InformationNodeConverters]::GetAssociatedChangesets($TfsBuildDetail)
Regards,

Jason
Aug 2, 2013 at 10:13 AM
Hi Jason,

Thanks for the info. I'll try it out.

Regards,
Fabian
Aug 2, 2013 at 3:28 PM
This is what I needed Jason. Thanks!!

Regards,
Fabian