none
Pre-Debug-Launch command RRS feed

  • Question

  • Hi,

    I'm looking for a way to run a certain command/script before the debugger tries to attach itself to a process.

    I'm not looking for a post-build event, because I don't want to trigger it on every build, I only want to trigger it when I start to Debug.

    I've looked into creating a custom extension, but for some reason I can't seem to be able to get the debugger to run, even though it's not showing any errors/exceptions.

    Does anyone know of a simple and clean solution to this?

    Monday, March 16, 2020 12:23 PM

All replies

  • Hi MIdasLamb,

    Welcome to MSDN forum.

    What is the type of your project?

    For C#, please right-click the project -> Properties -> Debug, and you could type your command in the "Command Line arguments". Besides, you can also use debugger class to run your script before your application, please type below code before all your code:

    if (Debugger.IsAttached)
    {
        //do sth
    }

    For C++, please  right-click the project -> Properties ->  Debugging, then type your command in command argument.

    Any feedback will be expected.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Tuesday, March 17, 2020 2:59 AM
  • It's a C# project, and I need to debug remotely.

    Those options won't work for me as I'm debugging remote, and I want the pre-launch event to happen locally, as there are some steps that need to occur on the local machine.

    • Edited by MidasLamb Tuesday, March 17, 2020 7:32 AM
    Tuesday, March 17, 2020 7:04 AM
  • Hi MidasLamb,

    Sorry for delay in reply.

    For your requirement, I'm afraid that the answer is negative. There are not related options which can be used to create debug event in remote debugger or VS IDE.

    Sorry for this inconvenience.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Friday, March 20, 2020 10:06 AM