Kirill's Visual Studio Tips
I decided to compile a small list of Visual Studio features that I use a lot.
Code Editor
- Code Snippets for ‘prop’, ‘foreach’, ‘if’, ‘class’, ‘interface’, Tab-Tab completion
- Surround with (snippets) - try, if
- Ctrl+K,D – FormatDocument
- Ctrl+Left/Right arrows in code editor – jump between words faster
- Ctrl+K,C – Ctrl+K,U – comment/uncomment selection
- Dynamic Snippets in the XML Editor - I bet a lot of people don't know about this one
Navigation
- F12 (Go To Definition) – position the caret on an identifier and hit F12
- Shift+F12 (Find All References) – then hit F8 to step through the results in the Find Symbol results window
- Click the “back” button on the Microsoft Explorer mouse with your thumb navigates back (under C# profile)
- Right-click on a document Tab – Copy Full Path, Open Containing Folder
Refactoring
- Position the caret on an identifier and hit F2 (Refactor -> Rename)
- Extract Method (Context Menu)
Code generation
- Generate Method Stub (Smart Tag) - Ctrl+. and enter
- WindowsContextMenuButton + O + ENTER + A – quick way to organize, remove and sort usings
Debugging
- Debug -> Exceptions (allows breaking on a first-chance exception)
- Right-click on a breakpoint brings up a context-menu which not everyone knows about ;-)
- Tools -> Options -> Debugging -> Enable just my code
- Attach to process -> Cross Platform Debugging (Managed, Native)
- .load sos, !clrstack, !dumpheap, !gcroot, etc.
Solution Explorer
- Tools -> Options -> Projects and Solutions -> Track Active Item in Solution Explorer
- Right-click on an item in Solution Explorer – Open Folder in Windows Explorer
- Right-click on a project -> Unload -> edit .csproj file in XML
Macros and automation:
- Coding productivity: macros, shortcuts and snippets
- 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.
Comments
Anonymous
October 21, 2008
You've been kicked (a good thing) - Trackback from DotNetKicks.comAnonymous
October 21, 2008
The comment has been removedAnonymous
October 21, 2008
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?Anonymous
October 21, 2008
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.Anonymous
October 21, 2008
My nickel: Ctrl+Alt+F10 - Show "Smart Tag" context menu from a keyboard.Anonymous
October 22, 2008
>> 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...Anonymous
October 22, 2008
Oops, I meant the "context menu" key located somewhere in between the right Alt and right Ctrl on some keyboards.Anonymous
October 22, 2008
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.Anonymous
October 22, 2008
Thanks! Ctrl+. is more suitable :о))Anonymous
October 24, 2008
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