11 Optimization Tips For Visual Studio

Trusted by

If you're new here, you may want to subscribe to my RSS feed or become a fan of this blog on Facebook. Thanks for visiting!

Sometimes ago I compiled this list for myself and our team to help get things done faster and deal with visual studio quirks.

Remember if you mess things up you can always reset your Visual Studio Settings (Tools->Import and Export Settings->Reset All Settings)

Visual Studio Optimization Tips:

  1. Disable F1. (Tools->Options->Environment->Keyboard) (I always end up hitting it by mistake when reaching for the escape key)
  2. Disable "Animate environment tools" (Tools->Options->Environment->General)
  3. Disable Start Page (Tools->Options->Environment->Startup)
  4. Disable "Track Active Item in Solution Explorer" (Projects and Solutions).
  5. Disable Navigation Bar (Tools->Options->Text Editor->C#)
  6. Set "AutoToolboxPopulate" to false (Tools->Options->Windows Forms Designer).
  7. Turn off Track Changes. (Tools->Options->Text Editor->Track changes)
  8. Bind Ctrl+Shift+k to Edit.LineDelete
  9. Bind Shift+Enter to Edit.LineOpenBelow
  10. Bind CTRL+SHIFT+ALT+Z to Attach To Process
  11. (Ctrl+K, Ctrl+D) to reformat the code when things get messy

If you have some tips on your own please share in the comments!

Hope this helps!

Hatim

12 Comments

Nice tips. Adding my favorite,

Highlight and Ctrl+k+c to comment out a block, ctrl+k+u to uncomment.

in your Visual Studio 2008 shortcut add a /nosplash at the end like so:

“C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe” /nosplash

Great Tips! My favorite you highlighted “CTRL + K + D” for code format.

Add to shortcut path /nosplash and save 5-10 second in start Visual Studio
Example: “…Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe” /nosplash

Why on earth would you want to disable “Track Active Item in Solution Explorer”? This one is a life saver (well, at least a time saver), especially when working on big projects. The file you want to find is usually hard to find, but hey, it’s still open and you’ve just worked on it - with this option enabled all you have to do to find it is return to its already open editor :-)

I would recommend on something a colleague told me - place a shortcut to “Close all windows” on the toolbar. Many times this is helpful when working on big projects, and the workspace gets messy.

Itai.

Thanks for the great tips!

Why key-bindings (8,9,10) are considered as optimization tips?

These commands are already bound to some other keys, why not keeping the default?

Here are my additions to some commands that are not bound by default:
Control+Shift+F4 = Close all files
Control+Shift+F6 = Rebuild all
Control+* = Collapse the whole solution tree (using a recursive macro)

I also disagree with 4. The default is disabled. I always enable it after a fresh install.

Michael Nielsen

April 28th, 2009
at 8:01am

Use the command window to open solution files instead of trying to find them in solution explorer.
CTRL+W,A opens the command window, then enter

of filename.cs

and then hit enter to open filename.cs.
The command window can be used to all sorts of things, i use a lot when debugging, much faster than using the mouse to inspect variables etc.

My tips are:
Ctrl + Num. = Edit.CollapseToDefinitions
Ctrl + Num0 = Edit.ToggleOutliningExpansion
Ctrl + Num1 = Edit.StopOutlining
(Ctrl + MO and Ctrl + MM is retarded for such a often used thing)

“Track Active Item in Solution Explorer” is nice, but it slows down the IDE a lot.

Alt + WW - window list

I don’t like regions. If they give the power to collapse/expand, one tends to write big chunks of codes and as a result one or more classes on the same file.

It’s not a good practice imho, thus to avoid the temptation of this I uncheck Tools/Options/Text Editor/General/Selection margin

@Itai because sometimes it’s DAMN annoying when it jumps around. You have scrolled to a certain position and you need to return there in a minute after you may have edited a document for example, and on the contrary this is incredibly annoying more so in large projects because it can be sometimes hazy tracking which project and deep sub folder you just had expanded. I don’t want it travel to my active document each time and then me having to find what I had just highlighted, for example if I’m half way through renaming files etc. then it jumps around if you have to visit the editor etc.

Now in it’s defence, sometimes I would want this behaviour, but for that there is Resharper’s “Locate in Solution Explorer” SHIFT+ALT+L.

Nicolas Séveno

April 29th, 2009
at 2:35pm

Place a shortcut to the following macro in the “Text editor” toolbar :

Public Sub InsertGUID()
Dim ts As TextSelection = ActiveDocument().Selection
Dim guid As System.Guid = System.Guid.NewGuid()
ts.Insert(guid.ToString().ToUpper())
End Sub

Ctrl+Shift+L is already bound to Edit.DeleteLine, so #8 is unnecessary!

Leave a Comment