Visual Studio - Attach to process shortcut

The easiest way to do this is to write a macro which finds the DTE.LocalProcess you wan to target and automatically attach. For example

Public Sub AttachShortcut()
  For Each proc In DTE.Debugger.LocalProcesses 
    If proc.Name = "what you're looking for" Then
      proc.Attach()
      Exit Sub
    End IF
  Next
End Sub

Note: This Stack Overflow Question is related and has a sample you may find useful

  • Attaching to a child process automatically in Visual Studio during Debugging

Writing a macro is one option, however it cannot deduct which process to attach to by itself.

Another nice solution is to map the "Attach to process" command to a shortcut key:

(Tools -> Options -> Environment -> Keyboard, type attach, like i did in this example, and select a shortcut key):

enter image description here


The shortcut is Ctrl+Alt+P in Visual Studio 2005 and above.


You can use the Alt key shortcut ALT+D,P to launch the "Attach to Process" window via Debug menu.

Once there, you can use your keyboard to search the list of Available Processes (e.g. type "w3wp" if you want to attach to an IIS app pool)