问题
For my debugging I have to attach to many process instances:
- The EXE for our app.
- 5 instances of some other process (let's call it "foo").
- 8 instances of some other process (let's call it "bar").
- 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?:
- Attach to and EXE called "whatever".
- All instances of a process called "foo".
- All instances of a process called "bar".
- All instances of a process called "Agnes".
回答1:
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.
来源:https://stackoverflow.com/questions/64396626/automating-attaching-to-multiple-processes-in-visual-studio-2019