Imports System Imports EnvDTE Imports EnvDTE80 Imports System.Diagnostics Public Module Debuggers Function AttachToProcess(ByVal processName As String) As Boolean Dim proc As EnvDTE.Process Dim attached As Boolean For Each proc In DTE.Debugger.LocalProcesses If (Right(proc.Name, Len(processName)) = processName) Then proc.Attach() attached = True End If Next Return attached End Function Sub AttachDebuggerToMbUnit() Dim processToAttachTo As String = "MbUnit.GUI.exe" If Not AttachToProcess(processToAttachTo) Then MsgBox(processToAttachTo & " is not running") End If End Sub Sub AttachDebuggerToWssTimerService() Dim processToAttachTo As String = "OWSTIMER.EXE" If Not AttachToProcess(processToAttachTo) Then MsgBox(processToAttachTo & " is not running") End If End Sub Sub AttachDebuggerToIIS() Dim processToAttachTo As String = "w3wp.exe" If Not AttachToProcess(processToAttachTo) Then MsgBox(processToAttachTo & " is not running") End If End Sub End Module