Follow @RoyOsherove on Twitter

A macro to automatically attach to aspnet_wp.exe

This was on the win-tech-off-topic mailing list:

A macro to automatically attach to aspnet_wp.exe, written by Kevin Dente can save lots of clicking around time:

<quote>

  Sub AttachAspNet()
        Dim process As EnvDTE.Process

        If Not (DTE.Debugger.DebuggedProcesses Is Nothing) Then
            For Each process In DTE.Debugger.DebuggedProcesses
                If (process.Name.IndexOf("aspnet_wp.exe") <> -1) Then
                    Exit Sub
                End If
            Next
        End If

        For Each process In DTE.Debugger.LocalProcesses
            If (process.Name.IndexOf("aspnet_wp.exe") <> -1) Then
                process.Attach()
                Exit Sub
            End If
        Next
    End Sub

Unfortunately, it's not perfect. Process.Attach doesn't let you
specify the program type (CLR, Script, native, etc). I think that it
uses whatever your last selection was in the UI. But don't quote me
on that, it's been a while.

</quote>

Where did the desktops disappear?

[Article] Introduction to Test-driven development with NUnit and the NUnit-Add-in