Visual Studio 2010 automation

Posted by JoelFan on Stack Overflow See other posts from Stack Overflow or by JoelFan
Published on 2010-05-17T18:16:23Z Indexed on 2010/05/17 18:20 UTC
Read the original article Hit count: 486

I am trying to run the following code (which I got from here )

Public Sub WriteToMyNewPane()
    Dim win As Window = _
       DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)
    Dim ow As OutputWindow = win.Object
    Dim owPane As OutputWindowPane
    Dim cnt As Integer = ow.OutputWindowPanes.Count
    owPane = ow.OutputWindowPanes.Add("My New Output Pane")
    owPane.Activate()
    owPane.OutputString("My text1" & vbCrLf)
    owPane.OutputString("My text2" & vbCrLf)
    owPane.OutputString("My text3" & vbCrLf)
End Sub

Instead of running it as a Macro, I want to run it as an independent console application that connects to a currently running instance of Visual Studio 2010. I'm having a hard time figuring out how to set the value of DTE. I think I may need to call GetActiveObject, but I'm not sure how. Any pointers?

© Stack Overflow or respective owner

Related posts about automation

Related posts about visual-studio