Search
Thursday, August 21, 2014 ..:: Home ::.. Register  Login
   Calendar  
     
  
   Search  
     
  
   Blogroll  
     
  
   Disclosure  
All blog entries are the opinions of the author and do not necessarily reflect the opinions of their employer. All the code presented is for explanation and demonstration purposes only. Any damages incurred to your site and/or data are not the responsibility of the author. Every effort is taken to ensure the code properly compiles, however sometimes there are some hiccups and you might be required to do your own debugging.
     
  
   TechTidBits (Blog)  

What do you do when you get a new install of Visual Studio?

Jan 31

Written by:
Saturday, January 31, 2009 3:00 PM  RssIcon

I've recently moved jobs and as such, find myself reconfiguring Visual Studio (again) to my liking.  I've had to rejig my VS install a few too many times and would like to create myself a bit of a reminder of the things I do in the future.  So read on to see what kinds of changes I like to make.  What do you like to change/modify for your VS installs?

I'm configuring my VS install at home.  Unfortunately, I found VS' Import feature does NOT work for me nor for my keyboard shortcuts. :<  I've found the only way to guarantee my settings will get created is to set them up manually.  What a PITA! :<  I've blogged about my other keyboard changes, but since moving to SVN, I've updated a few of them.  Read on for other changes I make too.

First and foremost, I start with a good base, I always pick the "Visual C# Development Settings."

Visual C# Development Settings

 Now that you have your base, you can customize.  Next I setup two vital keyboard shortcuts.  I set these up first cause after I play with Tools/Options, I sometimes like to click OK to save my settings, just in case I screw up and lose all my previous changes.  If you don't do this, you'll find yourself redoing it all.

Description Keystroke Comments
Tools.Options CTRL+SHIFT+ALT+T Direct access to view and change VS options.
Tools.CustomizeKeyboard CTRL+SHIFT+ALT+? Direct access to keyboard shortcuts.

Now we're ready to change VS settings.  Below is a complete listing of my customizations as well as reasons for them.

Grouping

Setting Changed from Default

Why/Reasons

Environment
Find and Replace Hide find and replace window after a match is located for Quick Find or Quick Replace Make the Find/Search window disappear as quickly as possible to let you get back to focusing in on the code.
Fonts and Colors

Change

Text Editor,

Printer and

[All Text Tool Windows] to the Consolas font.

This makes  most of the text you're looking at the same type as what you see in the code window.  I tend to like using the Consolas font.  Please read this blog entry for details about this great font.
Help, Online When loading help content, "Try local first, then online" If you can't figure it out yourself, wouldn't you ask for help?  Try locally to save time, chances are VS has been around long enough the local stuff is good enough for what you want to do.  If not, then you'll know where to goto on MSDN, Google, etc.
Import and Export Settings Use team settings file: set this to something your team uses for formatting options. This helps to keep the code looking at least somewhat similar when you try to diff it from your source control tool.
Startup At startup, Load last loaded solution and don't download content. I usually work on one solution, and if I need to jump to my test solution, I can always use shortcuts to goto File, Recent Projects and jump that way.  Or I can use the keyboard shortcuts (Alt+F, J and then some number for the solution I want to open).
Projects and Solutions
General

I change the Visual Studio project locations to whereever is the root of my development code base (usually C:\dev or d:\dev).

Uncheck the Track Active Item in Solution Explorer.

Check the Show Output window when build starts

When prompted to open, load, save, this option is used as the default location, and I like to have my dev dir close to the root of my HD, much easier to nav in a cmd window if you need to get to it.

When you have multiple files open, and when you're jumping around then in the code window,having your Solution Explorer flipping around to try to keep up with your code can be annoying.  Also, if you have a lot of projects in your solution (and the open directories in your code span multiple pages) as you "look" at the code, you will lose focus of the other adjacent files close to "that other file you were looking at as well."  Not to worry, there's a shortcut in the keyboard settings for when/if you do need to turn this back on.

Sometimes when you use the keyboard, you're too quick for VS, sad but true, this is one trick to quickly find out if VS understood your command to build your file/proj/solution.

Build and Run

Before building: Save all changes

Check Only build startup projects and dependencies on Run.

On Run, when projects are out of date, select Always build.

On Run, when build or deployment errors occur, select Do not launch.

Check For new solutions use the currently selected project as the start up project.

All of these settings are meant to minimize the chaff VS gives you when you want to run your program.  When your in a debugging session, you and to be "bugged" as few times as possible, therefore, if something, anything is out of date, is wrong, just take the most appropriate action.  If out of date, build it, if errors, then stop and report the errors so I can fix them and get back to debugging.
Text Editor
General

Uncheck Drag and drop text editing.

Uncheck Indicator margin.

Sometimes when I'm tired, I have the tendency to leave the mouse clicked a bit too long as I'm moving it.  Usuallly that's cool, no probs.  But with VS, I found I was moving code around by accident.  Uncheck this and the problem goes away.  If I want to move code, I'll cut'n'paste it around.

The indicator margin is only good to show bookmarks or breakpoints (can anyone else tell me what it's for?).  But when this is turned off, VS will highlight the whole line, so you don't lose the visibility of the feature, AND you gain a bit more screen realestate for your code.  Nice eh?

All Languages, General

Uncheck Apply Cut or Copy commands to blank lines when there is no selection.

Uncheck Line numbers.

Uncheck Enable single-click URL navigation.

Sometimes by accident you cut'n'paste something, then by accident cut'n'paste again (with nothing selected) then when you goto paste, you're pasting the blank line.  This option is to combat this from happening.  Ok, I have to admit it, I don't ever remember this happening to me personally, but this option makes sure it never will now!

Unchecking the line numbers gives me another little bit of screen realestate for my code.  Besides, you can always see the line number on the bottom right of VS, and CTRL+G will let you go explicitly to the line # you want anyways.

When was the last time you used your IDE as your browser?  HUH?  If you're browsing CNN with your IDE, you're trying to hard to live in Visual Studio, IMHO. :>

C#, Tabs Set the Tab size and Indent size to 2. This is usually a company, department style and is either dictated to you, or you're lucky to have your own freedom with this one.  Likewse the Insert Spacs or Keep Tabs is another "thou shalt do it this way" kind of setting (usually).  Setting to 2 and spaces is what my architect suggests so what the heck, I'll use it.
C#, Formatting, General

Uncheck the Automatically format on paste.

I used to leave this on, but with the PowerCommands and the reformating on save turned on, I can paste code in and either save the doc (thereby formatting it automagically) or I can continue to work on it in a predictable format (cause it's just like the way I cut/copied it).
C#, Formatting, Spacing

Set spacing for method calls, Check Insert space within argument list parenthesis.

Set other spacing options, Uncheck Insert space after keywords in control flow statements.

These are very much personal preference if you're lucky or dictated to you by more senior developers or architects.
C#, Formatting, Wrapping

Uncheck the Leave block on single line.

Uncheck the Leave statements and member declarations on the same line.

I find these help to make the code more readable when things are separate lines but this is a very personal thing.
HTML, Format

Check the Insert attribute value quotes when typing.

Uncheck the Tag wrapping, Wrap tags when exceeding specified length.

Proper XHTML compliance requires quotes around all attributes, therefore why not have VS put them in ASAP?

When I reformat html, I hate to see preformatted asp server tags which I've carefully constructed onto one line for visual appearance suddenly wrapped on the screen and my visual work of art graffittied!

HTML, Miscellaneous

Uncheck Auto ID elements on paste in source view.

If leave this in, you'll get VS automagically IDing your server tags on your behalf and you'll just have to select the ID value to change it anyways, chances are you were going to add one, so just cut to the chase and get VS to forget trying to help you out here.
Debugging
General Uncheck Ask before deleting all breakpoints. You need to do a CTRL+SHIFT+F9 to delete breakpoints, chance are I'm not going to do this by accident, so cut out one more dialog here.
HTML Designer
General

Select the Split View for Start pages in.

Uncheck Auto keyboard switching.

Check Split views vertically.

Although you take a bit of a performance hit the first time you view an HTML page with VS, selecting this view will show you both the GUI and the HTML, paired with the last option, you'll see them side by side vertically.

Uncheck the Auto keyboard switching if you always code in english, otherwise you might want to read up on this and have the keyboard mapped to the language specified in the HTML.

Since most people have widescreen LCDs now and I'm guessing most of them setup horizontally, splitting things vertically makes more sense than horizontally since you have MUCH more screen realestate across the screen horizontally than vertically.  By selecting to split thing vertically, you'll see two panes split down the middle of the monitor showing HTML and the GUI designer.  With this unchecked (default) you'll see your HTML and gui designer split up and down where you do not have as much pixel space.

Power Commands
 

Check Format document on save.

Check Remove and Sort Usings on save.

I used to manually format and play with the using statements, ensuring these two settings are checked will make sure this is done for me automagically.  Beautiful.

Those are all the settings EXCEPT for my keyboard customizations. :>  I've blogged about my favourite VS shortcuts before, but for now I'll just list the customizations.  Also note, if not otherwise stated, the scope of these shortcuts is Global.Global scope

Description Keystroke Comments
Close All But This CTRL+SHFT+F4 Sometimes you just want to narrow your focus to the one file you're currently editing.
Close All Documents CTRL+SHFT+ALT+F4 Sometimes you just want to start over with a clean slate.
Toggle Bookmark CTRL+Num *  Wax on/wax off.....uh oh, sorry, turn on, turn off, simple, that is if you use bookmarks
Next Bookmark In Document CTRL+Num 6   I like to use bookmarks when debugging/investigating my code.  Think of it like leaving breadcrumbs with hyperlinks to/from them.  They are link anchors in html.
Next Bookmark  CTRL+Num 9  
Previous Bookmark In Document

CTRL+NUM 4

 
Previous Bookmark CTRL+Num 7  
Build Page CTRL+SHFT+ALT+F6 To build JUST the web page your currently editing.
Tile Vertically CTRL+SHFT+ALT+V If you want to look at two pieces of code side by side.  You could add Tile Horizontally but I found I never used it, so why bother? 
Add Watch (Debug) CTRL+D, Num * To quickly add the focused variable to the debug watch list.
Project Properties CTRL+ALT+Num * I find I need to get to the this tab too often to mouse around for it.
Collapse Projects CTRL+ALT+Num - I find I need to do this too often to mouse or keyboard around to do it, PowerCommands gives you this feature, this alone makes it worthwhile to download it.  If you don't think so, you're not playing with enough projects in your solution IMHO.
Attach To Process CTRL+ALT+Num + You do this often enough that the default VS shortcut is still too cumbersome to use.

Project and Solution.View Class Diagram

CTRL+ALT+Num 9 If you're new on a project and want to get a high level view of the class structure, you'll love this shortcut.  Be forewarned though, this will create a new ClassDiagram1 file in your solution which if you're not careful will get checked in on your next commit.
Edit.Sort Usings CTRL+ALT+Num 8 Remove and Sort the using statements, great for cleaning up old (aka smelly :>) code.
Project and Solution.Show Log CTRL+ALT+Num 7 (Global) Gets the history of the file selected in the Solution Explorer.
Editor Context.Show Log CTRL+ALT+Num 7 (Text Editor) Gets the history of the file currently being edited.
Project and Solution.Revert Changes CTRL+ALT+Num 4 (Global) Backs out your changes for the selected file in the Solution Explorer.
Editor Context.Revert Whole File CTRL+ALT+Num 4 (Text Editor) Backs out your changes for he currently edited file.  Fast way to try something out, then get back the gold code. 
Project and Solution.Show Differences CTRL+ALT+Num 5 (Global) Shows differences between your codebase and what's checked in for the entire solution.
Editor Context. Show Differences CTRL+ALT+Num 5 (Text Editor) Shows differences between your codebase and what's checked in for the currently edited file.
Project and Solution.Commit CTRL+ALT+Num 6 (Global) Checks in the code for the entire solution.
Editor Context.Commit CTRL+ALT+Num 6 (Text Editor) Checks in the code for the file currently being edited.
Project and Solution.Show Changes CTRL+ALT+Num 2 Show what code has been updated since the last time you did an update (get latest).
Project and Solution.Update CTRL+ALT+Num 3 (Global) Update the entire solution.
Editor Context.Update CTRL+ALT+Num 3 (Text Editor) Update just the file currently being edited.
Track Activity In Solution Explorer CTRL+ALT+.

Finds and selects the currently edited file in the Solution Explorer. Since you have this option turned off from above, sometimes you will want to force VS to show you where the currently edited file is located in your directory structure.  Why wouldn't you know?  Maybe your using F12 to navigate your code and you've gone down some rabbits hole and can't find your way out.  Using this feature let's you do a submarine type of "pariscope up" to quickly find where you are.  Two caveats here, 1) this toggles the Options for Projects and Solutions for Track Activity in Solution Explorer on and off, so you'll probably have to do this twice to keep it the way you really want it (off).

Tools, Options, Track Activity In Solution Exporer

 

View Results 1 and 2 CTRL+W, 1 | 2 There are three Find Results windows, CTRL+W, Q gets you to the one you're probably familiar with, but there are two others, numbered 1 and 2.  Check out the bottom of the Find and Replace window for the Results options, there's two radio buttons at the bottom.  That way you can keep your existing Find Results while doing another Find!  Very cool!
Window.Window CTRL+SHFT+ALT + DOWN

The CTRL+ALT+Down arrow shows the Window.ShowEzMDIFileList, which is a list of open files on the top right of the IDE.  The only problem is it does not list paths and if you have long filenames, they are truncated and ellipses (...) put in their place so finding your specific file is difficult.

Having the Window.Window dlg popup (resizable :>) let's you specifically target which file you want to navigate to.

At this point, I would like to suggest exporting all your settings thereby backing them up.  However, the last time I did this (yesterday) all of my custom keyboard settings weren't saved (the xml node wasn't saved out for me with my settings).  I'm still holding out hope for VS10 to fix this problem.

This is going to help me with "remembering" my settings for the next time I get a new VS install which I hope won't be for a very long time.  Enjoy your coding tonight!

Tags:
Categories:
Location: Blogs Parent Separator TechTidBits

1 comment(s) so far...


Re: What do you do when you get a new install of Visual Studio?

One update and one addition.
CTRL+ALT+T for the Tools.Options, since using PowerCommands used the CTRL+ALT+O for it's own config window AND there's no way to change it, I have to adapt instead of it.
CTRL+W, F to open up the FogBugz window, this is a cool addin to VS to connect to FogBugz.

By phenry on   Wednesday, February 11, 2009 1:44 PM

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Add Comment   Cancel 
     
  
Copyright 1999-2012 by PCHenry.com   Terms Of Use  Privacy Statement