My Favorite Visual Studio Shortcuts and Tips

Hey everyone – I’ve been maintaining a list of little shortcuts to save me time and ease my development efforts and figured they would be worth sharing here. If you have any you would like to share here, please email me and I’ll include them as well.

Visual Studio Keyboard Shortcuts

  • Ctrl+. opens up the ‘Smart Tag’. Use it when you see the red squiggle line to add a missing reference, or implement an interface.
  • Ctrl+K,C will comment either the current line, or any block of code you have highlighted.
  • Ctrl+K,U will uncomment either the current line, or any block of code you have highlighted.
  • Ctrl+, opens smart search to quickly find and jump to a class or method name.
  • Ctrl+I allows you to do an inline search (basically search quickly without dialog box)
  • Shift+Alt+Enter for enter and leave full screen mode.
  • Ctrl+- moves cursor to last known position (helpful to navigate back, Ctrl+Shift+- is forward)

Visual Studio Features

  • Snippets, like ‘prop‘ will inject a property into your code, or ‘foreach‘
  • Custom snippets, click here for a starter list and how-to.
  • Right-click file in Solution Explorer, select Source Control > Annotate. This shows all history of the file and who checked in what line of code.
  • Use ‘Package Manager Console’ to install Nuget packages (Alt+T,N,O). (ex: PM> Install-Package Newtonsoft.Json)
  • Tell debugger to ‘break’ when an exception is thrown even if no breakpoint exists (Ctrl+Alt+E, then check Thrown on CLR).
  • From Visual Studio Command prompt, use this command to get a list of all checked out files (and to who): tf status /collection:http://my-tfs-server:8080/tfs/MyCollection $/pathto/mytfsproject /user:* /recursive
 

Kyle Ballard

Software engineer specializing in Ecommerce.