Custom MSBuild Task: how to flush logging in VS2012 output window while task is still running?

半腔热情 提交于 2020-01-11 05:07:06

问题


I have a custom MSBuild task that takes some time to complete. It outputs progress using either Log.LogMessage() or BuildEngine.LogMessageEvent() (tried both).

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.

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?).


回答1:


Known bug in VS2012.

We ended up making a VSPackage extension for VS2012/2013 (to directly output in pane log).

It is fixed in VS2015.




回答2:


It is a bug in VS 2012. In the comments in this bug report a user whose alias is Will, speaking on behalf of Microsoft, wrote on July the 2nd of 2013 that Though we will not have a chance to address this issue in Visual Studio 2012, we will consider this feedback when planning for future versions of Visual Studio.



来源:https://stackoverflow.com/questions/16690071/custom-msbuild-task-how-to-flush-logging-in-vs2012-output-window-while-task-is

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