Kirill’s Visual Studio Tips


I decided to compile a small list of Visual Studio features that I use a lot.


Code Editor



  1. Code Snippets for ‘prop’, ‘foreach’, ‘if’, ‘class’, ‘interface’, Tab-Tab completion

  2. Surround with (snippets) - try, if

  3. Ctrl+K,D – FormatDocument

  4. Ctrl+Left/Right arrows in code editor – jump between words faster

  5. Ctrl+K,C – Ctrl+K,U – comment/uncomment selection

  6. Dynamic Snippets in the XML Editor - I bet a lot of people don't know about this one

Navigation



  1. F12 (Go To Definition) – position the caret on an identifier and hit F12

  2. Shift+F12 (Find All References) – then hit F8 to step through the results in the Find Symbol results window

  3. Click the “back” button on the Microsoft Explorer mouse with your thumb navigates back (under C# profile)

  4. Right-click on a document Tab – Copy Full Path, Open Containing Folder

Refactoring



  1. Position the caret on an identifier and hit F2 (Refactor -> Rename)

  2. Extract Method (Context Menu)

Code generation



  1. Generate Method Stub (Smart Tag) - Ctrl+. and enter

  2. WindowsContextMenuButton + O + ENTER + A – quick way to organize, remove and sort usings

Debugging



  1. Debug -> Exceptions (allows breaking on a first-chance exception)

  2. Right-click on a breakpoint brings up a context-menu which not everyone knows about 😉

  3. Tools -> Options -> Debugging -> Enable just my code

  4. Attach to process -> Cross Platform Debugging (Managed, Native)

  5. .load sos, !clrstack, !dumpheap, !gcroot, etc.

Solution Explorer



  1. Tools -> Options -> Projects and Solutions -> Track Active Item in Solution Explorer

  2. Right-click on an item in Solution Explorer – Open Folder in Windows Explorer

  3. Right-click on a project -> Unload -> edit .csproj file in XML

Macros and automation:



  1. Coding productivity: macros, shortcuts and snippets

  2. How to map a Visual Studio macro to a keyboard shortcut?

P.S. Sara Ford has much much more in her famous Did you know series.

kick it on DotNetKicks.com

Comments (10)

Cancel reply

  1. You’ve been kicked (a good thing) – Trackback from DotNetKicks.com

  2. It turns out, Stephen Walther has a similar list of tips here:

    http://weblogs.asp.net/stephenwalther/archive/2008/10/21/essential-visual-studio-tips-amp-tricks-that-every-developer-should-know.aspx

    It is funny to see how we both recommend same tips. I honestly didn’t read his post before I posted mine.

  3. RednaxelaFX says:

    Hi,

    I recall the days when I was using VS2005, I used Ctrl+K,D to format code, but it changed to Ctrl+E,D in VS2008 (by default?). What’s the target version of VS in this post? And umm, why it is that sometimes the build command is associated with F6, but sometimes with Ctrl+Shift+B?

  4. Andrew says:

    Hi, another nice feature is file search.

    You can open ANY file in the solution by clicking Ctrl+/ and typing "open file" followed with the file name – tooltips would help 🙂

    Instead of "open file", one can use the "of" shortcut.

  5. My nickel: Ctrl+Alt+F10 – Show "Smart Tag" context menu from a keyboard.

  6. RednaxelaFX says:

    >> My nickel: Ctrl+Alt+F10 – Show "Smart Tag" context menu from a keyboard.

    I thought most of the time the "Smart Tag" context menu can be invoked with the "Win" key…

  7. RednaxelaFX says:

    Oops, I meant the "context menu" key located somewhere in between the right Alt and right Ctrl on some keyboards.

  8. This post is about Visual Studio 2008.

    RednaxelaFX: F6 vs. Ctrl+Shift+B depends on your profile settings (C# Profile vs. VB Profile). In C#, the default build keybinding is F6, in VB – Ctrl+Shift+B. You can go to Tools -> Import and Export Settings -> Import -> Visual C# Development Settings (WARNING, all your current settings will be lost unless you back them up).

    Viacheslav: Yes. Another one I use is Ctrl+. when the caret is near the Smart Tag.

  9. Thanks! Ctrl+. is more suitable :о))

  10. My latest in a series of the weekly, or more often, summary of interesting links I come across related to Visual Studio. Scott Guthrie posted the latest installment of links for ASP.NET, Visual Studio, WPF and Silverlight . Vance Morrison posted links

Skip to main content