locked
VCProjectConfigurationProperties; Is it possible to set a process number to Property Command RRS feed

  • Question

  • I have several instances of an executable file running. I need to programmatically attach to all instances. It is their process id's that separates them.

    I set the properties accordingly:

                        // Get project configuration properties
                        Project proj = mDte.Solution.Projects.Item(1);
                        Configuration configuration = proj.ConfigurationManager.ActiveConfiguration;
    
                        // Set configuration properties => attach to EcuClient.exe
                        configuration.Properties.Item("DebuggerType").Value = TypeOfDebugger.DbgNativeOnly;
                        configuration.Properties.Item("Command").Value      = "Qwerty.exe";
                        configuration.Properties.Item("Attach").Value       = true;

    I have read the documentation:

    https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.vcproject.vcprojectconfigurationproperties.command%28v=vs.120%29.aspx

    and

    https://msdn.microsoft.com/en-us/library/Microsoft.VisualStudio.VCProject.VCProjectConfigurationProperties_properties%28v=vs.120%29.aspx

    It seems that it is not possible to assign a process id instead of the process name (Qwerty.exe) to command. Is there some other way? Please let me know.

    Saturday, February 20, 2016 10:33 AM

Answers

  • Hi SailinShoes,

    Actually this forum is to discuss the debugger tool. Just to make this issue clearly, do you mean that you want to attach to your process using custom code?

    Based on the official document, we could know that the Command property specifies the executable file to start when you invoke the debugger, so it would use the executable file name, not the process ID.

    >>I need to programmatically attach to all instances.

    But my understanding is that you could think about how to get the process name from PID, and then attach to it using custom code like the following sample.

    http://stackoverflow.com/questions/4819750/get-process-name-from-pid-or-handle

    If I have misunderstood this issue, please feel free to let me know.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, February 22, 2016 9:41 AM
  • Hi SailinShoes,

    For the previous issue, I mean that you want to assign a process id instead of the process name (Qwerty.exe) to command, my understanding is that it would have a limitation.

    But you could submit this feature request: http://visualstudio.uservoice.com/forums/121579-visual-studio.
    The Visual Studio product team is listening to user voice there.

    But if you want to know whether there are other good workarounds for this issue, since you want to attach debugging using custom code, I think the language developing forum would be better for you. 

    >>Your suggestion was the very first I tried but unfortunately it does not work.

    The suggestion "get the process name from PID, and then attach to it using custom code" just is an idea of mine, I think you could post this issue to the language forum, I think we could get better response from the developing team members.

    You could select the correct language forum(VB/VC++/C#) here:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=csharpgeneral%2Cvbgeneral%2Cvcgeneral&filter=alltypes&sort=lastpostdesc

    Of course, if you meet any VS debugger tool/profiler tool issue, welcome to this forum:)

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, February 23, 2016 6:23 AM

All replies

  • Hi SailinShoes,

    Actually this forum is to discuss the debugger tool. Just to make this issue clearly, do you mean that you want to attach to your process using custom code?

    Based on the official document, we could know that the Command property specifies the executable file to start when you invoke the debugger, so it would use the executable file name, not the process ID.

    >>I need to programmatically attach to all instances.

    But my understanding is that you could think about how to get the process name from PID, and then attach to it using custom code like the following sample.

    http://stackoverflow.com/questions/4819750/get-process-name-from-pid-or-handle

    If I have misunderstood this issue, please feel free to let me know.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, February 22, 2016 9:41 AM
  • Thank you for your answer Jack. I am sorry for have posted my question in the wrong forum. Your suggestion was the very first I tried but unfortunately it does not work.
    Monday, February 22, 2016 1:33 PM
  • Hi SailinShoes,

    For the previous issue, I mean that you want to assign a process id instead of the process name (Qwerty.exe) to command, my understanding is that it would have a limitation.

    But you could submit this feature request: http://visualstudio.uservoice.com/forums/121579-visual-studio.
    The Visual Studio product team is listening to user voice there.

    But if you want to know whether there are other good workarounds for this issue, since you want to attach debugging using custom code, I think the language developing forum would be better for you. 

    >>Your suggestion was the very first I tried but unfortunately it does not work.

    The suggestion "get the process name from PID, and then attach to it using custom code" just is an idea of mine, I think you could post this issue to the language forum, I think we could get better response from the developing team members.

    You could select the correct language forum(VB/VC++/C#) here:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=csharpgeneral%2Cvbgeneral%2Cvcgeneral&filter=alltypes&sort=lastpostdesc

    Of course, if you meet any VS debugger tool/profiler tool issue, welcome to this forum:)

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, February 23, 2016 6:23 AM