自定义的MSBuild任务:如何刷新在VS2012输出窗口记录任务时仍在运行? [英] Custom MSBuild Task: how to flush logging in VS2012 output window while task is still running?
问题描述
我有一个自定义的MSBuild任务,需要一些时间才能完成。它使用输出进度为 Log.LogMessage()
或 BuildEngine.LogMessageEvent()
(试用过)。
I have a custom MSBuild task that takes some time to complete. It outputs progress using either Log.LogMessage()
or BuildEngine.LogMessageEvent()
(tried both).
我的问题是,直到任务完成,使得进度更新没用所有的输出不会出现在VS2012输出窗口。我想有而任务正在运行,马上输出显示。
My problem is that all output doesn't appear in VS2012 Output window until the task is completed, making progress updates useless. I would like to have output appearing while the task is running, right away.
我发现不同的线程解释经常叫 Application.DoEvents()
,但这似乎并没有解决问题(也许只适用于VS2010和过吗?)。
I found various threads explaining to call frequently Application.DoEvents()
, but that doesn't seem to solve the problem (maybe it only applied for VS2010 and before?).
推荐答案
在VS2012已知的bug。
Known bug in VS2012.
我们最终作出了VSPackage的扩展VS2012 / 2013(直接在面板日志输出)。
We ended up making a VSPackage extension for VS2012/2013 (to directly output in pane log).
它是固定在VS2015。
It is fixed in VS2015.
这篇关于自定义的MSBuild任务:如何刷新在VS2012输出窗口记录任务时仍在运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!