Visual Studio Hotkey for Web Devs: Attach to W3WP
Friends keep asking for this, so here are the instructions:
- In VS2010 open the Tools / Macros / Macro IDE menu item
- Create or edit the MyMacros project
- Add a new Module called "AttachToProcess"
- Replace all the code with the following:
- Save this macro
- Close the Macro IDE
- Right click the VS2010 menu bar
- Select Customize...
- Click Keyboard...
- Select Macros.MyMacros.AttachToProcess.IISWorkerProcess from the lists of commands
- Enter a shortcut in the box (I use Ctrl+Alt+A)
- Click Assign, then OK, then Close
- Open a web application, browse to the site and test your macro
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics
Public Module AttachToProcess
Sub IISWorkerProcess()
Dim attached As Boolean = False
Dim process As EnvDTE.Process
For Each process In DTE.Debugger.LocalProcesses
If process.Name.EndsWith("w3wp.exe") Then
process.Attach()
attached = True
End If
Next
If Not attached Then
MsgBox("Couldn't find w3wp.exe")
End If
End Sub
End Module
Very cool. I'm so used to typing Alt+d p w that I'd probably have to map this macro onto that key sequence ;-)
ReplyDeleteThanks Dave - from Jeff and DK
ReplyDelete