如何在Visual Studio 2010外接程序中写入输出窗口? [英] How do I write to the output window in Visual Studio 2010 AddIn?

查看:135
本文介绍了如何在Visual Studio 2010外接程序中写入输出窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个简单的Visual Studio 2010加载项,以便在工作中进行常见的复制工作(从libs sln中获取dll)。

I'm writing a simple Visual Studio 2010 Add-In to do a common copying job here at work (getting dlls from libs sln).

我想要复制的进度将被写入输出窗口。

I want the progress of the copying to be written to the output window.

我尝试了 Trace.WriteLine(...)期望这样做,但是当我在调试器中运行外接程序时却没有。我还没有其他尝试过的方法。

I tried Trace.WriteLine(...) expecting that to make it, but it doesn't when I run the add-in in the debugger. I have not tried it any other way yet.

我在Visual Studio 2008中发现了一些这样做的示例,但是所需的库无法引用。

I found some examples of doing that in Visual Studio 2008, but the required libs are not available to reference.

有人可以指出我如何写到输出窗口吗?我的谷歌搜索技能使我失败了。

Can anyone point me to how to write to the output window? My googling skills have failed me.

推荐答案

我已经为写的宏完成了此操作:

I've done this for a macro I wrote:

Window window = dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
OutputWindow outputWindow = (OutputWindow) window.Object;
outputWindow.ActivePane.Activate();
outputWindow.ActivePane.OutputString(message);

此处是DTE界面的链接:
http://msdn.microsoft.com/en-us/library/envdte.dte(v=VS .100).aspx

Here is a link for the DTE Interface: http://msdn.microsoft.com/en-us/library/envdte.dte(v=VS.100).aspx

这篇关于如何在Visual Studio 2010外接程序中写入输出窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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