TFS2010 - 记录的自定义生成活动内 [英] TFS2010 - Logging inside custom build activity

查看:144
本文介绍了TFS2010 - 记录的自定义生成活动内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个自定义生成活性,从而完成我们的构建的执行。我们使用自定义的活动,因为我们使用的编译器是非常特殊的,系统是很老,我们不希望重写整个事情,这样它的MSBuild工作。不过,库是由TFS管理,构建由TFS触发。

We have a custom build activity, which performs the execution of our build. We use a custom activity, because the compilers we use are very special and the system is quite old and we do not want to rewrite the whole thing so that it works with MSBuild. However, the repository is managed by TFS and the build shall be triggered by TFS.

在自定义生成活动,我想记录的状态。

Inside the custom build activity, I would like to log the status. Currently, I'm doing this with this piece of C# code:

private void LogMessage(String message, CodeActivityContext context)
        {
           BuildInformationRecord<BuildMessage> record =
             new BuildInformationRecord<BuildMessage>()
             {
                 Value = new BuildMessage()
                    {
                        Importance = BuildMessageImportance.High,
                        Message = message,
                    },
             };

            context.Track(record);
        }

它的工作原理,但有一个很大的问题:我们的自定义生成活动需要执行约6小时(正如我所说,这是一个古老的,也是大型软件项目)。问题是,日志消息只出现TFS生成汇总一次内部生成操作已完成。所以6小时建设后,所有日志消息出现一次。

It works, however there is one big problem: Our custom build activity takes about 6 hours for execution (as I said, it's an old and also large software project). The problem is that the log messages only appear inside TFS build summary once the build action has completed. So after 6 hours of building, all the log messages appear at once.

我们想拥有的是,消息显示,因为它们被记录。这样构建的人能看到构建目前,也看看发生了什么。

What we would like to have is that the messages are shown as they are logged. So that the build guy can see where the build currently is, and also see what happened.

一个解决方法,我实现至今是有自定义生成活动使用的是与工作流程的基础部分共享消息队列。然后,工作流基础内,我创建它执行生成并同时清空消息的队列中,并显示它们的并行陈述。下面是结构的截图:

One workaround I implemented so far is to have the custom build activity use a Queue of Messages which is shared with the workflow foundation part. Then, inside workflow foundation, I created a parallel statement which executes the build and at the same time empties the queue of messages and displays them. Here is a screenshot of that construct:

但是,结果是pretty令人失望。这是什么出来:

However, the result is pretty disappointing. This is what comes out:

红色为实际生成日志消息,它周围的一切都只是while循环和其他的东西...

The red one is the actual build log message, everything around it is just the while loop and the other things...

是否有可能转换的日志信息了吗?

Is it possible to switch those log messages off?

推荐答案

您可以尝试设置下列属性的生成过程模板XAML(无法通过设计师来完成)共进晚餐preSS消息:

You could try setting the following attribute on the Build Process Template XAML (cannot be done via the designer) to suppress the messages:

mtbwt:BuildTrackingParticipant.Importance="None"

例如,从我的模板:

example from my template:

<InvokeMethod DisplayName="Delete File" mtbwt:BuildTrackingParticipant.Importance="None" ... />

这篇关于TFS2010 - 记录的自定义生成活动内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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