When working in visual studio many times we have to search to find the option to perform some specific action.So lot of time is wasted in searching for the particular action in the menu.Knowing the Shortcut Keys in Visual Studio can be helpful for quickly performing a repeated task such as build.
You can identify the Shortcut Keys in Visual Studio by accessing the menu item.For example if you click the build option then you can see that shortcut key in visual studio for build is Ctrl+Shift+B
Below are some of the commonly used visual studio shortcut keys which would be helpful in performing commonly used actions in Visual Studio.
These shortcut keys in visual studio are segregated into different sections according to their usage.
Some common Shortcut keys in Visual Studio:
Build Related Visual Studio Shortcut keys
Following are some build related shortcut keys in visual studio .Visual Studio shortcut keys for build are most commonly used.So it would be helpful to know these shortcuts for any developer using Visual Studio.
Build Solution Ctrl+shift+b
Cancel build Ctrl+Break This one is useful when we want to stop a build which takes a long time.We may forget to add some changes ,at such times this is quite useful.
Visual Studio Shortcut keys for Comments
Comment selection Ctrl+K,Ctrl+C
Uncomment selection Ctrl+K,Ctrl+U
Collapse – Expand elements
These visual studio shortcut keys are helpful to view the structure of our program.
Collapse to definitions: Ctrl+M,Ctrl+O If we use this shortcut then we can see the main program elements such as classes and methods.
If we use this shortcut ,Ctrl+M,Ctrl+S inside a method/class then that method/class will be collapsed
File Related Shortcuts
To create a New File Ctrl+N
To create a New Project Ctrl+Shift+N
To open an existing File Ctrl+O
To open a Project Ctrl+Shift+O
To save all files Ctrl+Shift+S
To save the current file Ctrl+S
To cut the current line Ctrl+L.This can be used for quickly removing the current line.
These are some shortcuts in visual studio for activities related to refactoring code.
Rename Ctrl+R,Ctrl+R.To use the rename command move the cursor over the program element such as method name or class name and press Ctrl+R in succession.
EncapsulateField Ctrl+R,Ctrl+E Ctrl+R, Ctrl+E.To use this command select a field in a class.The field will be encapsulated in a property.
ExtractMethod Ctrl+R, Ctrl+M
IDE Related shortcut keys
These are the most commonly used Visual Studio Shortcut Keys for IDE related activities.
Displays solution explorer Ctrl+Alt+L
Displays server explorer Ctrl+Alt+S
Displays the class view window Ctrl+Shift+C
Displays the properties window F4
Displays the output window Ctrl+Alt+O
Deletes all the breakpoints Ctlr-Shift-F9
Go back to previous code Ctrl–-
Go forward to last line CtrlShift-
Bookmark related Visual Studio Shortcut Keys
Create/Remove bookmark.If the bookmark doesn’t exist then it is created otherwise it is deleted. Ctrl+K,Ctrl+C
Format document Ctrl+K ,Ctrl+D
Format Selection Ctrl+K ,Ctrl+F
Visual Studio Clipboard Ring shortcut keys
One very nice feature provided by Visual Studio is Clipboard ring.The last 15 cut or copied items are stored in the clipboard ring.
You can cycle through the clipboard ring using the following shortcut keys:
To cycle through the items in the clipboard ring press the above key combination is succession.So if you want to paste the second item then you need to press the key combination twice.Similarly for the third item in the clipboard ring you need to press the key combination thrice.
Other useful Visual Studio Shortcut Keys
For Completing the current word Ctrl+Space
For Moving the cursor to the matching brace Ctrl+]
For Displaying list of all references the selected element Shift+F12
Shift+ALT+ENTER Full Screen Mode.This shortcut makes the visual studio screen full size.To return to normal size we again use the same key.
Ctrl+F5For Starting the application without Debugging
F12 go to definition
Find a copied word or symbol Ctrl+F
Find references of an identifier Shift+F12
Find the next occurrence of the searched value Shift+F3
Displays intellisense for word completion Ctrl+J
Displays information for method parameter Ctrl+Shift+Space
Hope these shortcut keys in visual studio will be useful to you in common scenarios.