TFS 2010 问题与跟踪生成中的变更集是门控签入的结果 [英] TFS 2010 Issue with tracking Changesets in Builds that are a result of Gated Checkins

查看:29
本文介绍了TFS 2010 问题与跟踪生成中的变更集是门控签入的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了检索哪个Changeset包含在哪个Build中的信息,我们使用Team Foundation Sidekicks的Label Sidekick",我们将Build &希望找到新构建的变更集.

In order to retrieve the information which Changeset was included in which Build, we use "Label Sidekick" of Team Foundation Sidekicks, where we place the Label of the Build & expect to find the newly built Changeset.

我们在 TFS 2010 中的开发过程使用了门控"签入,因此我们面临的情况是,Sidekicks 中没有显示最新签入(我们实际上收到了上一个的变更集)建造).这是可以解释的,因为在进行标记时,尚未提交最新的更改.

Our development process in TFS 2010 is making use of 'Gated' checkins, so we are faced with the situation that the latest checkins are not presented in Sidekicks (we actually receive the changeset of the previous build). This is explainable, since at the time the labeling takes place, the latest changes have not yet been committed.

BuildLog 确实正确报告了关联的变更集.

The BuildLog does report the associated Changeset correctly.

我已经在我们的构建过程模板中进行了几次实验,但似乎无法得到我们需要的东西.例如,将 Labeling 活动置于Run On Agent"范围之外,导致构建一开始就失败,对象引用未设置为对象的实例".(我想这与我不得不扩大标签"和工作区"变量的范围以使第二部分运行的事实有关).
这次尝试的构建过程模板的之前"状态是这里(这个工作),之后"状态(对象引用未设置..")是这里.

I 've made several experiments in our Build Process Template but can't seem to get what we need. Placing, for example, the Labeling activity out of the "Run On Agent" scope, lead me to a build that fails at the very start with an "Object reference not set to an instance of an object." (I suppose this is related with fact I had to widen the scope for 'Label' & 'Workspace' variables to get the second part running).
The 'before' state of the build process template for this attempt is here (this works), the 'after' state ("Object ref not set..") is here.

所以,总而言之,两种不同类型的输入可以帮助我:

So, to summarize, two different types of input could help me out:

我应该如何更改我们的构建过程模板,以便在提交 Gated 签入之后 进行标记?(-- 这将使 Sidekicks 中的显示合理化)

How should I change our build process template so that the labeling happens after the Gated checkins have been committed? (-- This would rationalize the display in Sidekicks)

如何以编程方式检索每个构建的关联变更集?(-- 这将使我能够编写一个可以淘汰 Sidekicks 角度的小应用程序)

How can I programmatically retrieve the associated Changeset of each Build? (-- This would enable me to write a small app that could obsolete the Sidekicks angle)

推荐答案

您可以使用 TFS API 来完成这项工作.

You can use the TFS API to get this done.

        public static void GetBuild()
    {
        var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://tfsdevlonuk:8080/tfs/gazprom.mt"), new UICredentialsProvider());
        tfs.EnsureAuthenticated();
        var buildServer = tfs.GetService<IBuildServer>();

        // Get Project Name
        var versionControl = tfs.GetService<VersionControlServer>();
        var teamProjects = versionControl.GetAllTeamProjects(true);

        // Get Builds for a team project
        var buildDetails = buildServer.QueryBuilds(teamProjects[0].Name);

        // For each build
        foreach (IBuildDetail buildDetail in buildDetails)
        {
            // Get the build details
            var buildInfor = buildDetail.Information;

            // More build infor like shelveset, etc
            Debug.Write(buildDetail.LabelName + buildDetail.ShelvesetName);

        }

以上代码将帮助您以编程方式获取构建详细信息.我有一些关于如何以编程方式连接到 tfs 并使用 tfs api 的博客文章.http://geekswithblogs.net/TarunArora/archive/2011/06/18/tfs-2010-sdk-connecting-to-tfs-2010-programmaticallyndashpart-1.aspx

The above code will help you get the build details programatically. I have some blog posts on how to connect to tfs programmatically and use the tfs api. http://geekswithblogs.net/TarunArora/archive/2011/06/18/tfs-2010-sdk-connecting-to-tfs-2010-programmaticallyndashpart-1.aspx

这篇关于TFS 2010 问题与跟踪生成中的变更集是门控签入的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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