Visual Studio: configure debugging to join the process

I am using Visual Studio 2008; Can I configure project debugging options to automatically join a process with a specific name when I press F5?

Edit: The actual macro, indicating attachment to managed code:

Sub AttachToMyProcess() 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 = dbg2.GetProcesses(trans, "MyMachine").Item("MyProcess") proc2.Attach2(dbgeng) Catch ex As System.Exception MsgBox(ex.Message) End Try End Sub 
+4
source share
3 answers

It is possible. You can write such a macro

  DTE.Debugger.DetachAll() For Each proc As EnvDTE.Process In DTE.Debugger.LocalProcesses If proc.Name.IndexOf("processname") <> -1 Then proc.Attach() End If Next 

And then change the VS key bindings to execute this macro when the F5 key is pressed

+12
source

Try pressing CTRL + ALT + P. I assume you could reassign Debug.AttachtoProcess if you want.

+2
source

I wrote and an add-on for this, you can try.

+1
source

Source: https://habr.com/ru/post/1286273/


All Articles