TFS SDK: Query yesterday's builds

拟墨画扇 提交于 2019-12-10 15:35:18

问题


I can query for all builds within a TeamProject as follows:

  var bServer = teamProjectCollection.GetService<IBuildServer>();
  IBuildDetail[] builds = bServer.QueryBuilds("myTeamProject");

This yields all builds within the given myTeamProject. But I am only interested in yesterday's builds.

I can obviously filter after I 've gotten the results within builds.
Still I am wondering if there exists an overload of QueryBuilds() to get builds within a provided timespan.


Background:
In my original TFS build solution, a custom code activity would get catch the BuildDetail properties that are important to us & would add them in an Excel sheet using Microsoft.Office.Interop.Excel.
This was rather convenient, since it took place during Build & our "BuildLog.xls" was always up-to-date.

Unfortunately this lead to this issue, so I had to remove the code activity & I am currently implementing Plan B: A console application scheduled to kick-in once a day, that queries for yesterday's builds & adds them in my Excel file.


回答1:


You can create an IBuildDetailSpec object and specify the MaxFinishTime (the end of the time range) and MinFinishTime (the beginning of the time range) to get builds in a range.

IBuildServer has a method to create IBuildDetailSpec and a QueryBuilds method to query with this spec.



来源:https://stackoverflow.com/questions/7914104/tfs-sdk-query-yesterdays-builds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!