visual-studio-2010add-invisual-studio-addins

How do I write to the output window in Visual Studio 2010 AddIn?


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.


Solution

  • 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);
    

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