I am writing a custom tool and I currently have it doing what I want as far as functionality. I would like to be able to write to Visual Studio if something goes wrong. (Incorrectly formatted code or whatever).
Are there any standards for this? Right now I basically can force the tool to fail and Visual Studio puts in a warning that it has done so. I'd like a category in the Output window with any resulting messages I want to send. I could also live with a more descriptive task/warning in the Error list window.
Best Answer
Output Window
To write to the "General" output window in Visual Studio, you need to do the following:
If, however, you want to write to a custom window, this is what you need to do:
Details on IVsOutputWindow and IVsOutputWindowPane can be found on MSDN.
Error List
For adding items to the error list, the
IVsSingleFileGenerator
has a method callvoid Generate(...)
which has a parameter of the typeIVsGeneratorProgress
. This interface has a methodvoid GeneratorError()
which lets you report errors and warnings to the Visual Studio error list.The details of GeneratorError() can be found on MSDN.