Automating attaching to multiple processes in Visual Studio 2019

半腔热情 提交于 2021-01-29 10:48:46

问题


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".

回答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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!