我想知道在 C# 或 VB.NET 中,我是否可以随时发送 all 中写入的输出我的 IDE 的调试控制台,到剪贴板。
vb.net 中的示例伪代码:
For x as integer = 0 to integer.maxvalue
debug.writeline("test console line " & x)
next
Clipboard.SetText(Debug.Output)
我想复制调试控制台的所有行,包括在执行时写入的消息,只是全部:
WindowsApplication6.vshost.exe' (CLR v4.0.30319: WindowsApplication6.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. etc... test console line 1 test console line 2 test console line 3 etc...
我希望也许可以使用 DTE(或更简单)来完成,有什么想法吗?
最佳答案
我会这样走:
EnvDTE80.DTE2 dte2 = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.12.0");
TextSelection sel = dte2.ToolWindows.OutputWindow.OutputWindowPanes.Item("Debug").TextDocument.Selection;
sel.StartOfDocument(false);
sel.EndOfDocument(true);
Clipboard.SetText(sel.Text);
关于c# - 将整个调试控制台输出发送到剪贴板?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25097387/