64

My question is somewhat similar to this "How to stop debugging (or detach process) without stopping the process?"

but i want to detach from one process.

for instance, I have a windows form app which i also attach to a windows service. I want to detach from only service (detach all will remove debugging from all executions and hence i won't be able to debug other application).

P.S: If possible please mention for visual studio 2008 and 2010.

Community
  • 1
  • 1
Umer
  • 1,891
  • 5
  • 31
  • 43

4 Answers4

98

In the Processes window (Debug -> Windows -> Processes), right-click on the name of the process you want to detach, and on the shortcut menu, click Detach Process.

Centro
  • 3,892
  • 2
  • 25
  • 31
  • The right click didn't show any menu - is it because of some account settings ? or there is some configuration needed to get it. – Umer May 11 '11 at 13:10
  • 1
    @Umer Hm, it's strange. Anyway, try to see if you can do this via the Detach Process toolbar button in the Processes window. – Centro May 11 '11 at 13:14
  • 1
    In my case its not working. Terminate Process button is enabled. Could you help me in this regard – User1551892 Jan 09 '13 at 16:25
  • And what if I don't have any "Processes" option under Debug -> Windows ? – Shaggydog Apr 07 '14 at 12:32
  • @Shaggydog Enabled functions depend on Visual Studio edition (Community, Professional...). My be it's your case. – Hoborg Jul 28 '16 at 15:10
  • @User1551892 Same here, but I think it's because the unhandled exception (in my case at least) at which the process stopped is terminating the process anyway, so something in VS decides that detaching doesn't make sense in the context. – William Jul 14 '17 at 20:52
  • The "Detach" option here is disabled and I don't know why https://i.imgur.com/Q45qMsm.png – sergiol May 13 '20 at 18:17
  • Now I know why. I am debugging in Mixed mode https://stackoverflow.com/a/7563072/383779 – sergiol May 13 '20 at 18:20
14

Just wanted to share that the shortcut key combo (in VS2013) is Ctrl+Alt+Z to bring up the Process window. The window will only pop up if there is at least one process attached.

phuclv
  • 37,963
  • 15
  • 156
  • 475
haku
  • 4,105
  • 7
  • 38
  • 63
1

If you have Visual Studio Express, there is no Processes window and I did not realized how to detach only one process.

sebetovsky
  • 101
  • 7
  • Could you please clarify if you don't know how to detach in Express, or if you did figure out how, would you please tell us how. – Patrick M Apr 09 '18 at 19:37
1

If you are doing Mixed Mode debugging then neither the Debug > Detach All option nor detaching as mentioned in Centro's answer in this thread would work.

I see the Debug > Detach All option or Detach Process option in Debug > Windows > Processes dialog, when I am debugging in Native only or Managed only mode.

I have tested this on Visual Studio 2005 at least for now.

Reference: https://developercommunity.visualstudio.com/t/cannot-detach-from-process-the-debugdetach-all-opt/225642

Ozair Kafray
  • 13,351
  • 8
  • 59
  • 84