Tap into the Power of Visual Studio
Daily coding is a lot easier when you know how to use Visual Studio effectively. To optimize your experience with the latest Microsoft IDE, try these practical tips and shortcuts. (Part 1 of 3)
With a new version of Visual Studio coming out, it's a great time to take a look at the tool you spend so much time with in your daily routine. After a challenging beta cycle, Visual Studio 2010 is beautiful, functional and sufficiently stable, although you're likely to encounter a few quirks along the way.
Each time I work to come up to speed in a new version, I find tricks I could have also used in the previous version, so I'll cover tips new to Visual Studio 2010 Professional Edition and ones you can use in Visual Studio 2008. Each developer has a different style of working -- don't worry about learning every shortcut.
Q: I'm overwhelmed with the complexity of Visual Studio and feel like I'm just using a small part of the power. Do you have any tips on using it more effectively?
A: Windows 7 makes it easier to start Visual Studio. You can pin Visual Studio to the start menu or task bar, rearrange the task bar, and use the right-click jumplist to open a specific solution or open and close instances of Visual Studio. If you access a large number of solutions, pin the most important ones to the jumplist for easy access. You can also type part of an application in the text box at the bottom of the Start Menu to access it without navigating the Start Menu; this feature is especially useful for occasionally used applications like WinDiff or the SQL profiler.
The first time you open Visual Studio it displays the slightly intimidating question, "What kind of developer are you?" This decision primarily affects keyboard layout. The Visual Basic option limits the menus, so if you're a serious Visual Basic developer, I suggest you select either C# or the general developer option and then change your keyboard layout if you prefer the traditional Visual Basic layout.
The first place to go after upgrading Visual Studio is the Tools/Options dialog. There are a number of sensible changes to make. The default for the number of files in the most recently used file lists is four -- you might prefer the maximum value of 24. You can also set the startup options -- if you hated the Start Page and opted for different startup behavior in Visual Studio 2008, wait until you see the new start page before disabling it. The 2010 Start Page is prettier, more useful and customizable. Best of all, it goes away automatically when you open a project. Custom start pages can help with group communications, multiple RSS feeds and anything else you can dream up. For example, you can download a Visual Studio Tip of the Day Start Page.
Personalize Your Layout
Stop by the Fonts and Colors dialog, particularly if you do presentations. The default for selected text is difficult for some people to read, especially on some projectors. You can change this in any version of Visual Studio by selecting Text Editor/Selected Text and choosing black on a pale background such as yellow or a custom color. My eyes appreciate increasing the size of the small fonts used by default in tool windows and IntelliSense.
The Keyboard tab allows powerful personalization of your experience. You can set keystrokes for your favorite features, remap the keystrokes that you have trouble remembering, or map keystrokes to macros for truly custom behavior. You can also use the search feature of the keyboard dialog to see if a particular command is already mapped to a standard key in your keyboard layout. The keyboard-mapping page even allows exploration of what commands are available inside Visual Studio. A major improvement in Visual Studio 2010 is that right-click context menus now display mapped keystrokes.
If you're a Visual Basic developer, consider how you want Ctl-Y to behave. The Visual Basic keyboard mapping retains the historic Cut Line behavior. However, programs from Office to Finale Notepad use Ctl-Y as the shortcut for Redo. With such a drastic difference in meaning, you might want to remap this key.
Other helpful settings in Visual Studio 2010 and Visual Studio 2008 include line numbers, save a new project when it's created, open .XAML files in XAML View to avoid the designer delay, redirect debugger output to the Immediate window, or quiet the warning when files are modified outside the IDE by Expression Blend or external generation. Visual Basic programmers may want to select Option Strict for new projects to create a strongly typed experience by default.
In Visual Studio 2010 you can insert new tabs to the right of existing tabs for more consistency with programs like Internet Explorer. If you don't like something that's new in 2010, you can probably turn it off. Look for a "Show All Settings" checkbox at the bottom of the Options dialog if you chose Visual Basic as your development style. You can adjust your settings with confidence because if you mess things up entirely, you can reset it all in the Import/Export settings tab. You can also export settings for specific environments like pairing.
Kathleen is a consultant, author, trainer and speaker. She’s been a Microsoft MVP for 10 years and is an active member of the INETA Speaker’s Bureau where she receives high marks for her talks. She wrote "Code Generation in Microsoft .NET" (Apress) and often speaks at industry conferences and local user groups around the U.S. Kathleen is the founder and principal of GenDotNet and continues to research code generation and metadata as well as leveraging new technologies springing forth in .NET 3.5. Her passion is helping programmers be smarter in how they develop and consume the range of new technologies, but at the end of the day, she’s a coder writing applications just like you. Reach her at [email protected]