Visual Studio Shortcuts and Add on Tools

Avatar

Pam

This post from Premier Developer consultant Crystal Tenn walks you through customizing Visual Studio to work better for you and your organization.


I like tools that make my development faster and more organized. The small amount of time it takes to invest in installing and learning these tools pays off in the long run! I have listed out the shortcuts that I use in my Visual Studio and how to change your settings if you want to adopt some of my shortcuts or make up your own easy to remember ones. You can share settings across a team so that everyone is more productive and in sync. I like to change my new classes so that by default they are public, instructions are below. Also, I use add-ons to help check my spelling, so it is easy for others to find my work (hard for others to find my class if I spell it wrong) and I have listed a couple of options in this article. I did not go into this topic here as it is lengthy, but I also do recommend using ReSharper which has many tools to help you write code faster and more effectively!

*As a note, all screenshots are taken with Visual Studio 2017.

 

How to get to edit Visual Studio Shortcuts:

    1. Click on Tools > Options
    2. Under Environment, go to Keyboard. The highlighted section “Show commands containing:” corresponds to the “VS Mapping column” in the table that you will see next. If you press shortcut keys, you can assign a new shortcut to whichever command is selected. You can type in the shortcut keys to find out if it is used by anything currently by checking the box below that is greyed out in the screenshot that reads “Shortcut currently used by”, for example if you need to find the name of a shortcut you use, and you are not sure what it is called.
ActionVS MappingRecommended ShortcutHow to remember it:Default
Project / Files / References
Add a new classProject.AddClassCtrl + N, Ctrl + CN for New and C for ClassN
Add new ProjectFile.AddNewProjectCtrl + N, Ctrl + PN for New and P for ProjectN
Add existing ProjectFile.AddExistingProjectCtrl + N, Ctrl + EN for New and E for ExistingN
Set current project as startupProject.SetasStartUpProjectCtrl + S, Ctrl + PS Set as Startup and P and ProjectN
Add Reference to selected projectProject.AddReferenceCtrl + A, Ctrl + RA for Add and R for ReferenceN
Code Related
Comment out codeEdit.CommentSelectionCtrl + K, Ctrl + CY
Comment in codeEdit.UncommentSelectionCtrl + K, Ctrl + UY
Collapse all methodsEdit.CollapsetoDefinitionsCtrl + M, Ctrl + OY
Collapse all codeEdit.ToggleAllOutliningCtrl + M, Ctrl + LY
Uncollapse all codeEdit.StopOutliningCtrl + M, Ctrl + PY
Rename allRefactor.RenameCtrl + R, Ctrl + RY
Fix all code alignmentEdit.FormatDocumentCtrl + K, Ctrl + DY
Commenting template/// the line above what you want to comment, then hit enterY
Navigational
Go to DeclarationEdit.GoToDeclarationF12Y
Go to ImplementationEdit.GoToImplementationCtrl + F12Y
Navigate ToReSharper VS config defaultCtrl + TY
Go to Solution ExplorerView.SolutionExplorerCtrl + S, Ctrl + ES for Solution and E for ExplorerN
Go to Team ExplorerView.TfsTeamExplorerCtrl + T, Ctrl + ET for Team and E for ExplorerN
Go to Test ExplorerTestExplorer.Show.
TestExplorer
Ctrl + U, Ctrl + TU for Unit and T for TestsN
Previous pageView.NavigateBackwardCtrl + –Y
Forward pageView.NavigateForwardCtrl + Shift + –Y

 

How to export Visual Studio Shortcuts:

  1. Click Tools > Import and Export Settings ….
  2. On the popup, choose Export selected environment settings and hit Next >
  3. To choose only the keyboard settings, UNCHECK all settings, then go under options, go under environment, and then CHECK keyboard.

How to import Visual Studio Shortcuts:

  1. Go to the same menu from Tools > Import and Export Settings …
  2. Choose Import selected environment settings then hit Next >
  3. Select if you just want certain settings or all the settings, for Keyboard go to the same mapping as the screenshot above in the previous set of instructions.
  4. Choose the.vssettings file you want to import and where you want it stored.
  5. Hit Finish

How to set new classes to be public by default:

  1. Go to one of these locations, depending on which version of VS you own.
    • VS2015: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class
    • VS2017(RC): C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class
  2. Edit the template and add the public keyword before class. Add any other changes you would like to a default class or its usings.

Code Commenting Tool:

GhostDoc helps you with filling in as much of your comments as possible ahead of time so that you can go ahead and customize it a little bit more. It saves you time by putting in a default summary and all your parameters into plain English.
*Note Pro/Enterprise come with free spell checking Smile !

GhostDoc Community (free) for VS2017: https://marketplace.visualstudio.com/items?itemName=sergeb.GhostDoc

GhostDoc Pro/Enterprise/Community for VS2015: https://submain.com/download/ghostdoc/pro/

Cost of Pro/Enterprise editions: https://submain.com/order.aspx

Features for different editions: https://submain.com/products/ghostdoc.aspx#features

4-minute kick-starter tutorial: https://submain.com/ghostdoc/GettingStarted/

Spelling Check Tool: ReSpeller (free!)

If you don’t get GhostDoc’s paid versions and you want free spelling tools you can get it from the folks at JetBrains who made ReSharper by downloading this:

https://resharper-plugins.jetbrains.com/packages/EtherealCode.ReSpeller/

Avatar
Pam Lahoud

Follow Pam   

No Comments.