views:

314

answers:

1

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

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

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  A: 

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

Pete OHanlon
Thank you very much... I don't know why but I'm google-challenged today :(
Paolo Tedesco
No problem, and kudos for posting your solution.
Pete OHanlon