Welcome to MSDN Blogs Sign in | Join | Help

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
Published Tuesday, October 21, 2008 4:53 PM by Kirill Osenkov
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Even more assorted Visual Studio tips

Tuesday, October 21, 2008 11:40 PM by DotNetKicks.com

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# re: Kirill's Visual Studio Tips

Tuesday, October 21, 2008 11:43 PM by Kirill Osenkov

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.

# re: Kirill's Visual Studio Tips

Wednesday, October 22, 2008 1:06 AM by RednaxelaFX

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?

# re: Kirill's Visual Studio Tips

Wednesday, October 22, 2008 5:50 AM by Andrew

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.

# re: Kirill's Visual Studio Tips

Wednesday, October 22, 2008 7:38 AM by Viacheslav Ivanov

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

# re: Kirill's Visual Studio Tips

Wednesday, October 22, 2008 10:43 AM by RednaxelaFX

>> 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...

# re: Kirill's Visual Studio Tips

Wednesday, October 22, 2008 10:45 AM by RednaxelaFX

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

# re: Kirill's Visual Studio Tips

Wednesday, October 22, 2008 12:42 PM by Kirill Osenkov

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.

# re: Kirill's Visual Studio Tips

Thursday, October 23, 2008 5:16 AM by Viacheslav Ivanov

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

# Visual Studio Links #81

Friday, October 24, 2008 11:10 AM by Visual Studio Hacks

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

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker