I'm trying to save window layouts via DTE.WindowConfigurations.Add and restore them via DTE.WindowConfiguration.Apply.
This works fine in VS 2008, but in VS 2010/2012 I see that the window configuration is available until I restart Visual Studio, and then the window configuration seems to be gone.
Easiest way to repro interactively:
- Install the Microsoft PowerConsole extension, this is a dependency of the IronPython console extension (http://visualstudiogallery.msdn.microsoft.com/67620d8c-93dd-4e57-aa86-c9404acbd7b3).
- Install the Microsoft IronPython IronRuby console extension (http://visualstudiogallery.msdn.microsoft.com/777407db-348b-4ac6-8106-ce4da1bd3bd2).
- Start Visual Studio, start Power Console via View | Other Windows | Power Console. Select IronPython from the "Switch Console" dropdown in the toolbar.
- Enter this code:
import clr
clr.AddReference("EnvDTE")
from EnvDTE import WindowConfigurations
WindowConfigurations.Add(dte.WindowConfigurations, "Test 1")
for cfg in dte.WindowConfigurations: print cfg.Name- Note configurations are listed for Design, Debug, NoToolWin, and Test 1.
- Restart Visual Studio.
- Enter this code in Visual Studio IronPython console:
import clr
clr.AddReference("EnvDTE")
from EnvDTE import WindowConfigurations
cfg = WindowConfigurations.Item(dte.WindowConfigurations, "Test 1")
for cfg in dte.WindowConfigurations: print cfg.Name- Note that the last two lines result in errors "The 'Test 1' window configuration does not exist."