如何写入 Visual Studio 2010 AddIn 中的输出窗口?
我正在编写一个简单的 Visual Studio 2010 插件来完成工作中的常见复制工作(从 libs sln 获取 dll)。
我希望将复制进度写入输出窗口。
我尝试了 Trace.WriteLine(...)
希望能够成功,但当我在调试器中运行加载项时却没有成功。我还没有尝试过任何其他方式。
我在 Visual Studio 2008 中找到了一些这样做的示例,但所需的库无法引用。
谁能告诉我如何写入输出窗口?我的谷歌搜索技巧让我失败了。
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.
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.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正如 Robert 指出的,John 的代码在没有 ActivePane 时会抛出异常。如果存在活动窗格,它将使用活动窗格。
我对 Robert 的示例遇到的一个问题是取决于创建窗格的位置,在我的例子中是 Exec 方法,每次运行时都会创建多个具有相同名称的窗格。
包括我如何解决这个问题的例子。很简单,首先检查窗口是否存在......
As Robert pointed out, John's code will throw an exception when there is no ActivePane. If there is an active pane, it will use whichever pane is active.
One issue I have with Robert's example is depending on where you create the pane, which in my case is the Exec method, it will create multiple panes with the same name each time it is run.
Including my example as to how I got around that issue. Pretty simple, just check for the existence of the window first...
我正在编写一个 Visual Studio 插件并遇到了同样的问题,但是当尝试上述答案时,我发现该行:
给出了错误。
不过我现在找到了一种稍微不同的方法来解决这个问题:
I am writing a Visual studio add-in and had the same problem, however when trying the above answer I found that the line:
gave an error.
However I have now found a slightly different way to solve the problem:
我已经为我编写的宏完成了此操作:
这是 DTE 接口的链接:
http://msdn.microsoft.com/en-us/library /envdte.dte(v=VS.100).aspx
I've done this for a macro I wrote:
Here is a link for the DTE Interface:
http://msdn.microsoft.com/en-us/library/envdte.dte(v=VS.100).aspx