Question

I'm working on creating a Visual Studio VSPackage containing a Single File Generator (IVsSingleFileGenerator) and I want to be able to log events to the Visual Studio Error List (http://msdn.microsoft.com/en-us/library/33df3b7a(v=vs.110).aspx)

I am using the example base classes from Microsoft Visual Studio SDK (http://code.msdn.microsoft.com/windowsdesktop/Single-File-Generator-94d856d4). These classes have methods:

public class BaseCodeGenerator : IVsSingleFileGenerator
{
   void GeneratorError(uint level, string message, uint line, uint column);
   void GeneratorWarning(uint level, string message, uint line, uint column);
}

This lets me make errors and warnings, but not messages. The methods call IVsGeneratorProgress.GenerateError (http://msdn.microsoft.com/en-US/library/microsoft.visualstudio.shell.interop.ivsgeneratorprogress.generatorerror(v=vs.90).aspx). This method doesn't seem to let me wire up a 'message'.

I have tried trying to find a reference to the Error List window in Visual Studio so I could write directly to it, but I didn't see anything in VSConstants (http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.vsconstants(v=vs.80).aspx).

Anyone know how to log a Message to the Visual Studio Error List?

Was it helpful?

Solution 2

Not a direct answer as I don't think I ever solved that either. I chose to create and write to a new output window. Should be of some help to you, see the WriteLine method at the bottom of this source: http://code.google.com/p/csharptest-net/source/browse/src/Tools/CmdTool/VsInterop/BaseCodeGeneratorWithSite.cs

I think OutputTaskItemString might even do what you are asking.

OTHER TIPS

This just isn't appropriate, the Error List window can and should only display error and warning messages. The automation interfaces therefore don't help you do this.

If you want to generate additional chatter then you should write that to the Output window. Accessible through the IVsOutputWindowPane interface, this MSDN How-to topic shows sample source code in the LogAnnotationToOutputWindow() method.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top