attach a process to current visual studio debugger silently using command line .. RRS feed

  • Question

  • I want to attach a process to my current opened visual studio application.

    I have tried ..

    process proc = new process();

    proc.startinfo.filename = "vsjitdebugger.exe";

    proc.startinfo.arguments = "-p 2345";


    but in this a new debugger is being created and continue prompting me to do few steps.

    I want to attach the '2345' process to current visual studio solution using visual studio command line tools.

    someone pls help me out ...

    Wednesday, October 13, 2010 6:22 AM

All replies




    Process.Start() always start a new process, to attach to a process from a running VS instance, you may open Tools menu -> Attach to Process, in the Attach to Process Window, select the process you want to debug.

    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by eryang Wednesday, October 20, 2010 2:35 AM
    • Unmarked as answer by eryang Monday, August 22, 2011 3:14 AM
    Thursday, October 14, 2010 2:19 AM
  • yeah, doesn't really answer the original question of "how to attach debugger to a process from the command line."  I'd like to be able to do this as well.
    Thursday, August 18, 2011 4:08 PM
  • For attaching debugger of an existing instance of visual studio to a process through proc-id one may also try using automation model.
    Something like this, works for me (c# app):
          int ProcId = 5044; // valid process-id
          EnvDTE80.DTE2 dte2 = (EnvDTE80.DTE2)System.Runtime.InteropServices.
          foreach (EnvDTE80.Process2 proc in dte2.Debugger.LocalProcesses)
            if (proc.ProcessID == ProcId) 

    No warranty, Vista32
    With kind regards
    Friday, August 19, 2011 1:42 PM