Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
' original code from Ingo Rammer (
' ===== Create the Macro =====
' 1. Tools > Macros > Macro IDE
' 2. Right Click MyMacros > Add > Add Module
' 3. Paste in the code below:
' 4. Rename the Macro file DebuggingMacros
' ==== Add Macros to Debug Toolbar ====
' Enable the debug toolbar
' Click the dropdown on the far right and click "Add or Remove buttons" > click "Customize"
' Click "Add Command"
' Select Macro on the left panel
' Find the macro in the list on the right
' Click "ok"
' Click "Modify Selection" and rename the button
' * repeat for nunit macro
Public Module DebuggingMacros
Public Sub AttachToWebServer()
Dim AspNetWp As String = "aspnet_wp.exe"
Dim W3WP As String = "w3wp.exe"
If Not (AttachToProcess(W3WP)) Then
If Not AttachToProcess(AspNetWp) Then
System.Windows.Forms.MessageBox.Show("Can't find web server process")
End If
End If
End Sub
Public Sub AttachToNunitAgent()
Dim NunitAgent As String = "nunit-agent.exe"
If Not AttachToProcess(NunitAgent) Then
System.Windows.Forms.MessageBox.Show("Can't find nunit-agent process")
End If
End Sub
Public Function AttachToProcess(ByVal ProcessName As String) As Boolean
Dim Processes As EnvDTE.Processes = DTE.Debugger.LocalProcesses
Dim Process As EnvDTE.Process
Dim ProcessFound As Boolean = False
For Each Process In Processes
If (Process.Name.Substring(Process.Name.LastIndexOf("\") + 1) = ProcessName) Then
ProcessFound = True
End If
AttachToProcess = ProcessFound
End Function
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.