Get Build and Changeset Number from Team Foundation Server

I was instructed to use the TFS API to check which build has a changeset number after deployment. I haven't worked with TFS before, so basically I tried to use Google to find the answer. I've been with him for 2 days already, so I hope someone can push me in the right direction ...

Here's what I've done so far:

Uri collectionUri = new Uri("mytfs/tfs/");
var server = TfsConfigurationServerFactory.GetConfigurationServer(collectionUri);
server.Authenticate();
server.EnsureAuthenticated();
var service = server.GetService<TswaClientHyperlinkService>();
var projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("mytfs/tfs/collection"));
var cssService = projectCollection.GetService<ICommonStructureService3>();
var project = cssService.GetProjectFromName("project");

WorkItemStore workItemStore = projectCollection.GetService<WorkItemStore>();
WorkItemCollection workItemCollection = workItemStore.Query("SELECT * FROM WorkItems"); 

      

So, in the workItemCollection object, I tried several queries, but it seems to prevent me from modifying the database, using joins, etc. just a simple select / from statement.

I am on the right track - is this how I am supposed to get the build and changeset number? If so, where can I see which tables I need to query?

+3


source to share


1 answer


The problem is that you think of it as a database. This is not a database. It is an object model that allows you to programmatically access various aspects of TFS through a well-defined API.

Work item queries are not SQL, they are WIQL (Work Item Query Language). The work item object will definitely have a reference to an associated changeset, but it will not have an assembly reference. Some work item types have a "fixed in" field that will automatically update with the assembly, but not all of them, so it is not necessarily reliable.



To find specific assemblies, you need to use the service IBuildServer

and search for the assembly specification.

+2


source







All Articles