对于 VS 2012,我无法使用以下MSDN 代码清除调试器输出窗口,
基本上我无法将 DTE2 对象传递给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();
}
使用其他 SO 链接无法使其适用于 VS2012。