Visual Studio – Lean and Mean

Visual Studio has some serious bloat to it right out of the box. Tack on a few extensions, ReSharper and any number of other add-ons and your machine can be pretty taxed while running Visual Studio. Additionally, context menus and tool bars can expand to the point where it becomes detrimental to productivity. What I’ve noticed is that a lot of people do not realize how customizable the IDE really is. Here are a few things you can do to cut bloat and customize the IDE to meet your needs.

Some of these things involve registry hacks so make sure to back up any keys you intend to modify!

Trimming and tuning menus and toolbars

Context menus have to be the worst offenders for bloat. It seems like every extension or add-in adds something to a context menu. But did you know that you have full control of what is in every context menu in Visual Studio? Take a gander at the Tools->Customize menu option.

I would say about half of the context menu items for a project I don’t really need. Realize that you can always add a command back. Clicking the Add Command button brings up another window with all the commands that available to you in Visual Studio.

The same customization works for Toolbars and regular menu items as well.

Hide Toolbars and the Main Menu

To get a little more real estate out of your Visual Studio window you can eliminate the toolbars and main menu from the top of the screen. Toolbars can be hidden just by right-clicking and unchecking the checked items. I usually have all my toolbars disabled. With the addition of the Hide Main Menu extension you can completely eliminate the top region of space that is wasted by these controls.

Modify the External Tools

There is a list of external tools found in the Tools main menu item that includes, for example, Create Guid and Error Lookup. These items are fully customizable. You can even add additional tools or remove the preexisting tools. It is a great place to put some frequently used SysInternals tools.

Manage Custom Exceptions

As you might know, you can configure Visual Studio to break on thrown or user handled exceptions of specific types. This makes it easier to debug at particular locations. The list of evaluated exceptions can be modified. Just click add in the Exceptions dialog.

One neat trick is that if you want to add a new group of exceptions, you can tweak the registry. Just create a new key under the target Debug engine GUID that you want the exception to be evaluated within. It adds a few erroneous exceptions into the category but it is still much easier to find the exceptions.

Steps to create a new CLR exception category:

  1. Add a new key that represents the name of your category to HKLM\Software\Wow6432Node\Microsoft\VisualStudio\10.0\AD7Metrics\Exceptions\{449EC4CC-30D2-4032-9256-EE18EB41B62B}
  2. Add a new value “Code” with a value of 0 to the key
  3. Add a new value “State” with a value of 4022 (hex)
  4. Repeat steps 1-3 but in the key “HKCU\Software\Microsoft\VisualStudio\10.0_Config\AD7Metrics\Exceptions\{449EC4CC-30D2-4032-9256-EE18EB41B62B}”

Disable Unneeded Packages, Editors, Projects or Services

Visual Studio is built on packages. Packages are registered with Visual Studio and are loaded automatically or manually by other packages or the IDE. Many of the registered packages go unused. Packages are intended to be lazy loaded so disabling all unused packages won’t net the benefit that it may suggest. Disabling packages does prevent Visual Studio from loading or analyzing the package, theoretically saving processing time and memory.

I’ve created a tool called VSTweaker that can not only disable packages, but also individual editors, projects and services. You’ll need to shutdown and restart Visual Studio for the effects to be seen. You’ll need to run VSTweaker as administrator.

NOTE! Please use this at your own risk. You can easily make Visual Studio unstable utilizing the tool. Please backup your registry before using this tool! The keys modified are under HKLM\Software\Wow6432Node\Microsoft\VisualStudio and HKCU\Software\Microsoft\VisualStudio.

VSTweaker Usage Example

Here’s an example of how to use VSTweaker. Personally I do not use the performance tools all the much. Occasionally I will use them but definitely not a day-to-day tool.

I can conceivably uninstall the feature if I wanted to but who knows, I might just need it. I know when I install Visual Studio I certainly install the full package so there are a lot of packages that go unused. To simply disable the performance tools until I need it, I can crack open VSTweaker and disable the “PerformancePackage”. Now if I load up Visual Studio you will see the Analyze menu is missing most of its options.

Since the package was never loaded we saved a few extra cycles and a tab bit more memory.


VSTweaker

Hiding Unneeded Options Pages

An package can add a new page to the Options dialog. Disabling a package will render the page inoperable but it will not remove it from the list. Options page definitions are stored in the registry here:

HKLM\Software\Wow6432Node\Microsoft\VisualStudio\10.0\ToolsOptionsPages

The direct children of the ToolsOptionsPages are the categories seen in the Options dialog. Child pages are housed underneath these category keys. To hide a particular option page from the Options dialog add the value “NoShowAllView” to the key with a value of 1. Reload Visual Studio and you will no longer see the options page.

Notice that my general page is now absent.

Disabling entire categories seems a bit flaky. It seems that you have to disable each child page before the entire category disappears but it doesn’t always seem to work.

You can leave a response, or trackback from your own site.

3 Responses to “Visual Studio – Lean and Mean”

  1. [...] Visual Studio – Lean and Mean | Adam Driscoll’s Blog. Share and [...]

  2. Steve says:

    Now that I have installed the VSTweaker extension in Visual Studio 2010 how do I access it?

    • adamdriscoll says:

      Hey Steve,

      It’s not actually an extension. It’s just an executable that modifies the registry keys for Visual Studio. Just run the VSTweaker.exe.

Leave a Reply

In an effort to prevent automatic filling, you should perform a task displayed below.



7 − = two