出力ウィンドウ
、次の実行する必要があります。
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
をただし、カスタムウィンドウへの書き込みをしたい、場合は、 IVsOutputWindowとIVsOutputWindowPane上
IVsOutputWindow outWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow;
// Use e.g. Tools -> 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
詳細はMSDNで見つけることができます。これは、あなたが何をする必要があるかです。エラーリストに項目を追加するための
エラー一覧
、IVsSingleFileGenerator
はタイプIVsGeneratorProgress
のパラメータを持つメソッド呼び出しvoid Generate(...)
を持っています。このインターフェイスには、void GeneratorError()
というメソッドがあり、エラーと警告をVisual Studioのエラーリストに報告できます。
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);
...
}
...
}
GeneratorError()の詳細は、MSDNにあります。
標準出力への書き込みがなぜ機能しないのですか? – avakar
Console.Writeにメッセージを書き込んでも出力ウィンドウに何も表示されません。 –