Automatic window cleaning in Visual Studio

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

Thank you for your suggestions.

+8
debugging visual-studio immediate-window
source share
1 answer

Here is a macro that does this. In the IDE Class View Macro, navigate to MyMacros - EnvironmentEvents. Open (double click) EnvironmentEvents. Paste the following code inside the 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: macro in EnvironmentEvents

See my short tutorial on how to create and execute a VS macro.

+9
source share

All Articles