Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 647
Eric Brown - Cal Avatar asked Oct 14 '11 21:10

Eric Brown - Cal


People also ask

How do I write to output window in Visual Studio?

You can write run-time messages to the Output window using the Debug class or the Trace class, which are part of the System. Diagnostics class library. Use the Debug class if you only want output in the Debug version of your program. Use the Trace class if you want output in both the Debug and Release versions.

How do I save output in Visual Studio?

Press Ctrl+S. Visual Studio prompts you for a location to save the build output.

How do I display the output window or console in Visual Studio?

Visual Studio Output Window usage and description. A developer also can display application runtime diagnostic messages to the output window using Debug or Trace class from . NET API. The output window can be open in two ways, first is from the menu bar, select View > Output, or using the shortcut key Ctrl+Alt+O.


1 Answers

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

like image 192
John Cornell Avatar answered Sep 28 '22 02:09

John Cornell