I have a number of build definitions that get executed based upon a single branch in TFS (eg Main).
I’d like to (somehow) query TFS to find all builds containing a specific changeset number that I supply, and return a list of string of the names of the builds that TFS contains. Any kind of app (VS extension, CLI app, winforms, whatever) will do.
Note: this isn’t a ‘plz give me the code’ request; I’m willing to hoof it and do serious work on this. Any pointers to documentation on how to query the database or SDK, or an example of how to query builds; just some place to start looking would be extremely helpful. Thanks.
The following snippet will crawl all Build Definitions of all Team Project of a Collection, and will check each and every build for an Association to the input changeset number:
Needless to say, this is a brute force attack.
You can further refine the code if you narrow down the list of
buildDefinition, make focus on specificteamProjectsetc. In any case I can hardly imagine the above to be useful as-is!Apart from (obviously) MSDN, a great resource for TFS-SDK is Shai Raiten’s blog.
For Build-Speficic examples, check also here & here for some possibly interesting SO posts.