Saving the DTE:\WindowConfigurations on exit

Feb 28, 2013 at 5:45 PM
I have created a new-item in DTE:\WindowConfigurations and after closing and opening Visual Studio that new-item is no longer in the set of window configurations. What is the correct way to force Visual Studio 2012 to save these changes?
Mar 2, 2013 at 7:40 PM
Window configs are tricky and seem to have changed behavior from 2008 to 2010 (and by proxy 2012).

TL;DR: use new-item to create a new config, then immediately call invoke-item on the new config. the config will then be saved when you exit visual studio and reloaded when you start visual studio again.

Window configurations are saved to the %APPDATA%\microsoft\visualstudio\11.0 folder as winprf (windows profile) xml files. In addition there is a windows.index file that is basically an index of config names to winprf files.

using new-item adds an entry to the windows.index file; however it does NOT force the creation of the winprf file that actually stores the windows settings. This seems to be done only if the windows configuration is applied (using invoke-item). This is different from the 2008 behavior, where the dte operations backing new-item would magically create the index entry and winprf file for you.

I've changed the behavior of new-item for the windows configuration path to force the persistence of the windows configuration. It'll be available in the next maintenance release; until then the workaround is this:
new-item dte:/windowconfigurations/myawesomeconfig # this creates the index
invoke-item dte:/windowconfigurations/myawesomeconfig # this forces VS to acknowledge the profile and save it on exit.