Managing multiple Visual Studio Layouts
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?
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.
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.
This is an old question, but since it came up in my Google search, I am adding an answer.
I'm looking into http://perspectives.codeplex.com/ (found it from http://www.addictivetips.com/windows-tips/save-windows-tool-panes-layouts-with-visual-studio-2010-perspectives/). It adds "Perspectives" to Visual Studio 2010. I haven't decided if it is fully meets my needs, but it looks promising.
There are many aspects of Eclipse that are better, or at least more configurable, or at least that I like how the work better than Visual Studio.
精彩评论