dla VS 2012, nie jestem w stanie wyczyścić okno wyjściowe debuggera używając następujących MSDN code,Jak wyczyścić okno wyjściowe debuggera Visual Studio 2012
Zasadniczo nie jestem w stanie przekazać obiekt DTE2, aby ClearExample
.
public void ClearExample(DTE2 dte)
{
// Retrieve the Output window.
OutputWindow outputWin = dte.ToolWindows.OutputWindow;
// Find the "Test Pane" Output window pane; if it doesn't exist,
// create it.
OutputWindowPane pane = null;
try
{
pane = outputWin.OutputWindowPanes.Item("Test Pane");
}
catch
{
pane = outputWin.OutputWindowPanes.Add("Test Pane");
}
// Show the Output window and activate the new pane.
outputWin.Parent.AutoHides = false;
outputWin.Parent.Activate();
pane.Activate();
// Add a line of text to the new pane.
pane.OutputString("Some text." + "\r\n");
if (MessageBox.Show("Clear the Output window pane?", "",
MessageBoxButtons.YesNo) == DialogResult.Yes)
pane.Clear();
}
Użycie innych linków SO nie może spowodować, że będzie działało dla VS2012.
Is it possible to programmatically clear the Ouput Window in Visual Studio?
Can the Visual Studio (debug) Output window be programatically cleared?
Dodaj EnvDTE odniesienia: dla VS10: C: \ Program Files (x86) \ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ PublicAssemblies \ EnvDTE.dll – mvermand
W moim systemie 64-bitowym (Windows 10 z Visual Studio 2015) 'EnvDTE.dll' znajdował się pod ścieżką' C: \ Program Files (x86) \ Common Files \ Microsoft Shared \ MSEnv \ PublicAssemblies'. –