आउटपुट विंडो
दृश्य स्टूडियो में "सामान्य" उत्पादन खिड़की को लिखने के लिए, आपको निम्न कार्य करने होंगे:
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
एक विधि कॉल void Generate(...)
किस प्रकार IVsGeneratorProgress
की एक पैरामीटर है है। इस इंटरफेस में एक विधि void GeneratorError()
है जो आपको विजुअल स्टूडियो त्रुटि सूची में त्रुटियों और चेतावनियों की रिपोर्ट करने देती है।
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() का विवरण एमएसडीएन पर पाया जा सकता है।
क्यों मानक आउटपुट आप के लिए काम करने के लिए लिख नहीं है? – avakar
कंसोल पर एक संदेश लिखना। मुझे आउटपुट विंडो में कुछ भी नहीं देता है। –