Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<h1>Output Window</h1> <p>To write to the "General" output window in Visual Studio, you need to do the following:</p> <pre><code>IVsOutputWindow outWindow = Package.GetGlobalService( typeof( SVsOutputWindow ) ) as IVsOutputWindow; Guid generalPaneGuid = VSConstants.GUID_OutWindowGeneralPane; // P.S. There's also the GUID_OutWindowDebugPane available. IVsOutputWindowPane generalPane; outWindow.GetPane( ref generalPaneGuid , out generalPane ); generalPane.OutputString( "Hello World!" ); generalPane.Activate(); // Brings this pane into view </code></pre> <p>If, however, you want to write to a custom window, this is what you need to do:</p> <pre><code>IVsOutputWindow outWindow = Package.GetGlobalService( typeof( SVsOutputWindow ) ) as IVsOutputWindow; // Use e.g. Tools -&gt; Create GUID to make a stable, but unique GUID for your pane. // Also, in a real project, this should probably be a static constant, and not a local variable Guid customGuid = new Guid("0F44E2D1-F5FA-4d2d-AB30-22BE8ECD9789"); string customTitle = "Custom Window Title"; outWindow.CreatePane( ref customGuid, customTitle, 1, 1 ); IVsOutputWindowPane customPane; outWindow.GetPane( ref customGuid, out customPane); customPane.OutputString( "Hello, Custom World!" ); customPane.Activate(); // Brings this pane into view </code></pre> <p>Details on <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsoutputwindow.aspx" rel="noreferrer">IVsOutputWindow</a> and <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsoutputwindowpane.aspx" rel="noreferrer">IVsOutputWindowPane</a> can be found on MSDN.</p> <h1>Error List</h1> <p>For adding items to the error list, the <code>IVsSingleFileGenerator</code> has a method call <code>void Generate(...)</code> which has a parameter of the type <code>IVsGeneratorProgress</code>. This interface has a method <code>void GeneratorError()</code> which lets you report errors and warnings to the Visual Studio error list.</p> <pre><code>public class MyCodeGenerator : IVsSingleFileGenerator { ... public void Generate( string inputFilePath, string inputFileContents, string defaultNamespace, out IntPtr outputFileContents, out int output, IVsGeneratorProgress generateProgress ) { ... generateProgress.GeneratorError( false, 0, "An error occured", 2, 4); ... } ... } </code></pre> <p>The details of <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsgeneratorprogress.generatorerror.aspx" rel="noreferrer">GeneratorError()</a> can be found on MSDN.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload