TFS SDK:查询昨天的构建 [英] TFS SDK: Query yesterday's builds

查看:21
本文介绍了TFS SDK:查询昨天的构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以查询 TeamProject 中的所有构建,如下所示:

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

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

这会生成给定 myTeamProject 中的所有 builds.但我只对昨天的构建感兴趣.

builds 中获得结果后,我显然可以进行过滤.
我仍然想知道是否存在 QueryBuilds() 的重载以在提供的时间跨度内获得构建.

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.

背景:
在我最初的 TFS 构建解决方案中,自定义代码活动将捕获对我们很重要的 BuildDetail 属性.将使用 Microsoft.Office.Interop.Excel 将它们添加到 Excel 工作表中.
这相当方便,因为它发生在 Build &我们的BuildLog.xls"始终是最新的.

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.

不幸的是,这导致了这个问题,所以我不得不删除代码活动 &我目前正在实施计划 B:一个控制台应用程序计划每天启动一次,查询昨天的构建 &将它们添加到我的 Excel 文件中.

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.

推荐答案

您可以创建一个 IBuildDetailSpec 对象并指定 MaxFinishTime(时间范围的结束)和 MinFinishTime(时间范围的开始)以获得范围内的构建.

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 具有创建 IBuildDetailSpec 的方法和使用此规范进行查询的 QueryBuilds 方法.

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

这篇关于TFS SDK:查询昨天的构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆