Skip to content

Instantly share code, notes, and snippets.

@OndeVai
Created June 14, 2012 00:53
Show Gist options
  • Save OndeVai/2927455 to your computer and use it in GitHub Desktop.
Save OndeVai/2927455 to your computer and use it in GitHub Desktop.
attaches debugger for VS
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics
Public Module Module1
Sub AttachDebugger()
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("Managed")
Dim proc2 As EnvDTE80.Process2
Try
proc2 = dbg2.GetProcesses(trans, "").Item("WebDev.WebServer.EXE")
Catch ex As Exception
proc2 = dbg2.GetProcesses(trans, "").Item("w3wp.exe")
End Try
proc2.Attach2(dbgeng)
Catch ex As System.Exception
MsgBox(ex.Message)
End Try
End Sub
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment