user3390380
user3390380

Reputation: 57

Automating attaching to multiple processes in Visual Studio 2019

For my debugging I have to attach to many process instances:

  1. The EXE for our app.
  2. 5 instances of some other process (let's call it "foo").
  3. 8 instances of some other process (let's call it "bar").
  4. 41 instances of some other process (let's call it "Agnes" in honor of the Twilight Zone episode, "From Agnes with Love").

Rather than having to Ctrl-select all of them and then click "Attach", is there some sort of template I can define that will say?:

  1. Attach to and EXE called "whatever".
  2. All instances of a process called "foo".
  3. All instances of a process called "bar".
  4. All instances of a process called "Agnes".

Upvotes: 0

Views: 246

Answers (1)

Sergey Vlasov
Sergey Vlasov

Reputation: 27890

You can use my Visual Commander extension to automate it with code like:

foreach(Process proc in DTE.Debugger.LocalProcesses)
{
    if(proc.Name.ToString().EndsWith("foo.exe"))
    {
        proc.Attach();
    }
}

See Attach to specific Process shortcut in Visual Studio for more details.

Upvotes: 1

Related Questions