visual studio 2008 macro:写入输出窗格

时间:2023-01-14 18:48:03

In a Visual Studio macro, how do you write execution information on the output pane (i.e. the window that usually contains build output)?

在Visual Studio宏中,如何在输出窗格(即通常包含构建输出的窗口)上编写执行信息?

I'm using Visual Studio 2008, if that is relevant.

我正在使用Visual Studio 2008,如果这是相关的。

Solution: I added the following subs to my macro project, I'm posting them here in case they could be useful.

解决方案:我在我的宏项目中添加了以下子项,我将它们发布在这里,以防它们有用。

Private Sub Write(ByVal name As String, ByVal message As String)
    Dim output As Window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)
    Dim window As OutputWindow = output.Object
    Dim pane As OutputWindowPane = window.OutputWindowPanes.Item(name)
    pane.Activate()
    pane.OutputString(message)
    pane.OutputString(Environment.NewLine)
End Sub

Private Sub Log(ByVal message As String, ByVal ParamArray args() As Object)
    Write("Debug", String.Format(message, args))
End Sub

Private Sub Log(ByVal message As String)
    Write("Debug", message)
End Sub

1 个解决方案

#1


2  

A quick search revealed this article on Code Project. It should be able to help you.

快速搜索揭示了关于代码项目的这篇文章。它应该能够帮助你。

#1


2  

A quick search revealed this article on Code Project. It should be able to help you.

快速搜索揭示了关于代码项目的这篇文章。它应该能够帮助你。