Created
August 7, 2019 11:31
-
-
Save andrewconnell/d55e58998a32881f4aab8dc3f6f15c6c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' This routine attaches to the ASP.NET worker process: | |
Sub AttachTo_ASPNETWP() | |
Dim attached AsBoolean = False | |
Dim proc As EnvDTE.Process | |
Dim processToAttachTo AsString | |
' name of the process to attach to | |
processToAttachTo = "aspnet_wp.exe" | |
' iterate through all processes running on the local machine | |
ForEach proc In DTE.Debugger.LocalProcesses | |
' if the last [X] characters of the process name = name of the process... | |
If (Right(proc.Name, Len(processToAttachTo)) = processToAttachTo) Then | |
' attacj to the process | |
proc.Attach() | |
' set a flag that we've attached to the process & exit the for loop | |
attached = True | |
ExitFor | |
EndIf | |
Next | |
' if macro didn't find process running, notify user | |
If attached = False Then | |
MsgBox(processToAttachTo & " is not running") | |
EndIf | |
EndSub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment