How to make CTRL + / toggle a comment in Visual Studio

How can I make CTRL + / toggle a comment in Visual Studio, as it does with XCode and Eclipse?


Solution 1:

Toggle single line comment and toggle block comment commands have been added in VS 2019 for C#

You can change the shortcut for these commands to whatever you want in Tools -> Options -> Environment -> Keyboard, search for Edit.ToggleBlockComment or Edit.ToggleLineComment.

Solution 2:

You can't make it toggle without going into either a macro or other VS extension.

However, I always setup VS to comment with Ctrl + / and uncomment to Ctrl + Shift + /

You can customize the keyboard shortcuts by going int the "Tools" menu and selecting "Options". Then select "Keyboard" from the "Environment" branch. From there you can bind the Edit.CommentSelection and Edit.UncommentSelection commands to whichever keyboard shortcuts you'd like.