When you use a tool day-in and day-out you typically want it to be accessible as quickly as possible and to launch just the way you like it, with all your favorite bells and whistles ready to go. For those of us saving the world every day with our .NET applications, Visual Studio is no exception. So here are a couple of easy tips for fine-tuning Visual Studio to get you from the icon to the code just a little bit faster, as well as a few of my own preferred features and settings.
1. Get rid of the splash screen. Believe it or not, that little splash screen is causing you precious seconds that could be better spent refactoring the code you wrote yesterday. To get rid of it on startup, simply right click on your Visual Studio icon and select Properties. In the Target property, append the "/nosplash" flag. Voila! No more splash.
2. Open up the IDE to an empty environment. All those tabs you left open the last time you used Visual Studio are going to try and open up again for you. Instead, get rid of them before closing Visual Studio and it won't have to take the additional effort to re-open them. Also, close that pesky Start Page for good. I mean, who reads that thing anyways? If you ask me, keeping it around just keeps me waiting longer to get to the important bugs I want to fix. To disable it, go to Tools | Options... and select the Environment | Startup node. In the "At Startup" drop down, select Show empty environment.
Ok, so maybe these tips won't save enough time to help you beat the afternoon traffic home. But once you use them, you'll be glad you did.
1. Open up your pages in the View of your choice. All of us have a preference. Some like to develop visually (I mean, it is called Visual Studio, you know), while others prefer to play directly with the angle brackets. And there are those few who like to develop with both at the same time. Well, it's time to start your pages in the view you prefer. Go to Tools | Options... and select the HTML Editor | General node. Select the "Start pages in" radio button that best suites your development style.
2. Set your tabs. I don't know about you, but I feel very strongly about how my tabs are formatted in my code. Some development teams have strict rules about this sort of thing. But for those of us fortunate enough to be able to make our own rules about how tabs are formatted, this is a must-do. Head back to Tools | Options... and select the Text Editor | All Languages | Tabs node (note: if you want to create custom rules for each language, skip the "All Languages" node and instead choose the language of your choice). Here you can set the tab and indent sizes (measured in number of spaces), and choose whether or not to insert spaces or tabs. The difference is, in your code file tabs can either be saved as space characters or a single tab character. Don't forget to select what kind of indenting you like. Here's a blog post which explains the difference between the options.
Favorite Key Bindings
1. Ctrl-Shift-B. Quickly build your solution. Who wants to take the time to hit the Debug | Build Solution menu option?
2. Ctrl-. (Ctrl + period). I love this one. Easily fix any problems with your code: add using statements, insert a method stub, etc. Any time you get red squigglies, this one comes to your rescue with a suggestion box full of solutions to your problem.
3. Alt-D, P (or Ctrl-Alt-P). Quite possibly my favorite. If you've already launched Visual Studio's built-in web server, there's no need to hit F5 to launch and debug your application again. Simply hit this key combination (or select the Debug | Attach to Process... menu option) and attach the IDE to the process the web server is running in. Now debug your heart out.
I hope these tips help in some way to make your coding world a little better. More to come...