Visual Studio User Settings: Window Layouts

It has been suggested that people would like to further understand some of the behind
the scenes concepts of how the VS IDE works when it comes to user settings. 
Like testing, this blog thread could last a while so I’m taking it in small chunks.
Needless to say we currently use a fun mixture of registry settings, user “readable”
xml files, and binary preference files.  This makes the creation of a tool or
command that makes all your settings really difficult.  It’s something that I’d
eventually love to build into the VSTweak
. Today I’ll cover how we store window management settings for the IDE
in Visual Studio 2002 and 2003.  

In %Program Files%\Microsoft Visual Studio .NET 2003\Common7\IDE you will find a file
named devenv.xml.  This file was put down on the install of VS and contains all
of the information for the default window layouts.  When Visual Studio is run
for the first time this file is copied to the user settings location for VS in the
“Application Data” directory under \microsoft\visualstudio\7.1.  From this point
on your layout changes are saved here on shutdown. 

There are different named window layouts stored within the devenv.xml file. 
By default VS associates these with a mode such as debugging.  Notice that starting
the IDE for the first time does not yield any debug windows.  Debug into an application
and you the debug windows will become active since you entered debug mode and the
debug layout is applied.  Through the extensibility model you can store and switch
to any number of window layouts.

The VSWindowManager
serves as a good example of how one can take advantage of the window
management extensibility.   This tool allows you to both auto-switch to
different layouts when you go from coding to form designing and also will let you
save and switch to your own window layouts on the fly.  If you check out that
project you’ll find some great sample source code you could take advantage of for
your own tweaks.

The devenv.xml file in the application data directory is portable and can be moved
from machine to machine if you would like to take your window layouts with you. 
The file in this location can also be deleted if you run into problems with your window
layouts.  Deleting this file has been known to solve the following issues: 

• Can’t open debug windows anymore when debugging. 

• A black blank window that you can’t get rid of.

• Windows refuse to hide or un-autohide when rolled over.

One down lots more settings to go. 🙂


Comments (4)

  1. josh ledgard says:

    Ok, so keep in mind that deleting that file will cause you to lose all of your window settings, but it’s probably worth it if you have the problems I described.