views:

317

answers:

2

Is there a quick way to attach to process in vs.net 2008 (attaching to the IIS process)?

Everytime I stop the debugger, and want to re-run I have to go to Debug -> attach to process -> choose the aspnet_web.exe

A: 

Ctrl+Alt+P and select aspnet_web.exe from the list if you're using Win XP.

Vadim
+4  A: 

You can record a macro to do it. In VS2005 I did this:

  • ctrl-shift-R (start recording)
  • ctrl-alt-P (attach to process)
  • select the process
  • OK
  • ctrl-shift-R (stop recording)

To play back the temporary macro, ctrl-shift-P. It generated the following code in the Macros IDE:

Sub TemporaryMacro()
 Try
     Dim dbg2 As EnvDTE80.Debugger2 = DTE.Debugger
     Dim trans As EnvDTE80.Transport = dbg2.Transports.Item("Default")
     Dim dbgeng(1) As EnvDTE80.Engine
     dbgeng(0) = trans.Engines.Item("Native")
     Dim proc2 As EnvDTE80.Process2 = dbg2.GetProcesses(trans, "<machine-name>").Item("cmd.exe")
     proc2.Attach2(dbgeng)
    Catch ex As System.Exception
     MsgBox(ex.Message)
    End Try

End Sub

You can convert this to a permanent macro in the Macros IDE and then bind it to a keystroke in the Tools-Options-Keyboard pane.

1800 INFORMATION
Awesome, thanks!
orip