Visual Studio - Attach to process shortcut

后端 未结 12 674
情歌与酒
情歌与酒 2020-11-27 16:42

When I want to debug I have to do Debug->Attach to Process -> Look for a process in the list -> Attach.

I was wondering if I can create some kind of a shortcut to

相关标签:
12条回答
  • 2020-11-27 17:13

    I use this built in "Shortcut"

    ALT+D, P, W, ENTER

    this opens the debug menu, selects attach to process, scrolls down to w3wp.exe and attaches.

    It's long but should work in multiple visual studio versions with no setup required, with or without resharper and it works when running multiple IIS processes as you can choose which process to attach to.

    0 讨论(0)
  • 2020-11-27 17:13

    To enable the 'Attach to Process' toolbar button in Visual Studio 2013, 2015, 2017, and 2019

    1. Right-click on any toolbar and click 'customize...'
    2. Click the 'commands' tab
    3. Click the 'Toolbar' radio button
    4. Select the toolbar where you want your button to appear from the dropdown
    5. Click the 'Add Command...' button
    6. Select 'Debug' from the categories list on the left
    7. Select 'Attach to Process' from the commands list on the right, and click ok. The button will appear on your selected toolbar.
    8. Optionally, use the 'Move Up' and 'Move Down' buttons on the right to move your new button to your desired location within the toolbar. I keep mine just after the Debug button.
    0 讨论(0)
  • 2020-11-27 17:16

    You can use the Alt key shortcut ALT+D,P to launch the "Attach to Process" window via Debug menu.

    Once there, you can use your keyboard to search the list of Available Processes (e.g. type "w3wp" if you want to attach to an IIS app pool)

    0 讨论(0)
  • 2020-11-27 17:19

    Personally I prefer to use Debugger.Launch() as suggested here in this thread, because it doesn't need for references to the DTE (that's IDE-specific and must be explicitly referenced into the project to be used)

    0 讨论(0)
  • 2020-11-27 17:20

    Writing a macro is one option, however it cannot deduct which process to attach to by itself.

    Another nice solution is to map the "Attach to process" command to a shortcut key:

    (Tools -> Options -> Environment -> Keyboard, type attach, like i did in this example, and select a shortcut key):

    enter image description here

    0 讨论(0)
  • 2020-11-27 17:23

    Addins are probably a better way to do this now. I use one called "Attach to anything". You can find them in Visual Studio 2012. Go to "Tools" -> "Extensions and updates", search for "attach", and install "attach to anything".

    Also see: Automate "Attach to Process" in Visual Studio 2012

    0 讨论(0)
提交回复
热议问题