Visual Studio 中的即时窗口自动清理

发布于 2024-08-22 18:00:07 字数 302 浏览 5 评论 0原文

我有一个关于在 Visual Studio 中调试的问题。是否可以在每次启动调试应用程序之前自动清除 Visual Studio 中的立即窗口? >cls 命令和上下文菜单->全部清除 很有用,但它们不是自动的,每次运行应用程序时都需要个人注意。同样,System.Diagnostics.Debug.Print()|Write*() 方法只能将消息写入即时窗口,因此 >cls 不适用。问题有解决办法吗? (目前我使用VS 2008)

谢谢您的建议。

I have a question about debugging in Visual Studio. Is it possible to clear the Immediate Window in Visual Studio automatically before each startup of a debugged application? The >cls command and Context Menu->Clear All are useful, but they are not automatic and require personal attention each time I run the application. Again, System.Diagnostics.Debug.Print()|Write*() methods can only write messages to the Immediate Window, so >cls is not applicable. Is there any solution for the problem? (Currently I use VS 2008)

Thank you for suggestions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

断舍离 2024-08-29 18:00:07

这是执行此操作的宏。在宏 IDE 类视图中导航至 MyMacros - EnvironmentEvents。打开(双击)EnvironmentEvents。在模块中插入以下代码:

Private Sub BuildEvents_OnBuildDone( _
    ByVal Scope As EnvDTE.vsBuildScope, _
    ByVal Action As EnvDTE.vsBuildAction) _
    Handles BuildEvents.OnBuildDone

    Try
        Dim activeWin As Window = DTE.ActiveWindow
        Dim immedWin As Window = DTE.Windows.Item("{ECB7191A-597B-41F5-9843-03A4CF275DDE}")
        immedWin.Activate()
        DTE.ExecuteCommand("Edit.ClearAll")
        activeWin.Activate()
    Catch ex As Exception
    End Try
End Sub

在这里您可以看到它应该是什么样子:
宏中环境事件

请参阅我的快速教程 如何创建和执行 VS 宏

Here is the macro that does it. In the Macros IDE Class View navigate to MyMacros - EnvironmentEvents. Open (double-click) EnvironmentEvents. Insert the following code inside module:

Private Sub BuildEvents_OnBuildDone( _
    ByVal Scope As EnvDTE.vsBuildScope, _
    ByVal Action As EnvDTE.vsBuildAction) _
    Handles BuildEvents.OnBuildDone

    Try
        Dim activeWin As Window = DTE.ActiveWindow
        Dim immedWin As Window = DTE.Windows.Item("{ECB7191A-597B-41F5-9843-03A4CF275DDE}")
        immedWin.Activate()
        DTE.ExecuteCommand("Edit.ClearAll")
        activeWin.Activate()
    Catch ex As Exception
    End Try
End Sub

Here you can see how it should look like:
macro in EnvironmentEvents

See my quick tutorial how to create and execute VS macro.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文