Attach to IIS in Visual Studio (v2)

A better version of the process attach macro:
(from http://stackoverflow.com/questions/822955/how-can-i-make-a-visual-studio-macro-to-attach-the-debugger-to-all-instances-of-w)

    
Sub AttachToAspNET()
        Try
            Dim dbg2 As EnvDTE80.Debugger2 = DTE.Debugger
            Dim trans As EnvDTE80.Transport = dbg2.Transports.Item("Default")
            Dim dbgeng(3) As EnvDTE80.Engine

            dbgeng(0) = trans.Engines.Item("T-SQL")
            dbgeng(1) = trans.Engines.Item("Managed")

            For Each theProcess As EnvDTE80.Process2 In dbg2.GetProcesses(trans, Environment.MachineName)
                If theProcess.Name.Contains("w3wp.exe") Then
                    theProcess.Attach2(dbgeng)
                End If

            Next
        Catch ex As System.Exception
            MsgBox(ex.Message)
        End Try
    End Sub
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *