views:

84

answers:

2

I'm currently using Visual Studio 2008. As other applications, it saves its layout in their setting folder. That's fine. But, my problem is that I often launch 3~4 Visual Studios, and change each instance's layout.

However, Visual Studio can only remember a single set of layout of the last terminated instance. I don't blame this limitation as this is a just normal behavior.

I'd happy if multiple layouts could be saved, or it would be perfect if Visual Studio allows per-solution/project layout saving. Is there anyone who wants this sort of feature? Is it feasible to make such extension?

+1  A: 

Note: I started writing an answer but further testing showed that it does not work as well as I had hoped. Here it is anyway. Maybe it can help you going further.

VS has the notion of storing different layouts, based on what the developer is doing. While debugging, windows can be positioned differently than during "normal" editing. Start debugging and windows move/show/hide in order to be in the same position as the last debugging session. Stop debugging and the windows move back to the state before debugging.

I guess you knew this already, but what's great is that you can add new layouts yourself.

If you open the macro editor (Alt-F11), you'll see a samples project, which has a 'Utilities' file. There, you'll find 2 macros, SaveView and LoadView, which save and load the current window configurations. Each one asks for the view name.

I tried creating a new layout/view, hiding windows and moving them and then re-loading the view. It worked great.

You could change the macros to load or save a view by solution name. Or have one pair for editing and one pair for debugging. If you write an add-in, you can get notified of a solution load, but I don't know if you can detect the starting of a debug session.

What is not so great is that if you leave VS and re-launch it, loading a previously-saved layout does not work very well (e.g. some tool windows don't come back to where they were). Maybe it's worth studying the underlying class (WindowConfiguration), but it's not an easy solution.

Timores
A: 

If you're not switching frequently between the layouts then one option may be to use the Tools > Import and Export Settings... menu item.

This allows you to save selected sub-sets of the preferences, and one of the available sub-sets (last one in the 'general' section) is 'Window Layouts'.

Unfortunately I can't see any way (macros, etc) to easily automate this process, so you would have to manually import the approriate settings whenever you wanted to switch - about 5 or 6 clicks through a wizard. Not great if you want to do it for every IDE session you load up.

Jason Williams