I just published the first release of my Settings Switcher extension for Visual Studio 2012 on CodePlex.
Yesterday, I was looking for a quick solution to switch between Visual Studio settings files (.vssettings) without using the Tools > Import and Export Settings… dialog. The dialog’s great, but it’s a bit slow to use a wizard every time I want to switch settings. Sometimes I like to jump back and forth between different solutions quickly during the day, like when I’m working on various open source projects with different code formatting requirements. I wanted a quicker way to load settings after opening a solution.
I found this blog post, which had a link to a tip on Sara Ford’s blog showing how easy it is to create a command button in the IDE to switch between settings by writing a simple macro.
Unfortunately, Visual Studio 2012 doesn’t support macros.
So I decided to create a Visual Studio extension. The original premise was simply to show a drop-down list containing all of the .vssettings files and when one is selected those settings are applied. That turned out to be a useful feature of the extension; however, while I was developing it I realized that I could add a few more useful features. For example, I added a button to format every code file in the solution according to the currently selected settings.
But the primary feature, IMO, is that when you close a solution or exit Visual Studio, the extension saves a reference to the current settings file in the solution’s user options file (.suo). The next time that you open that solution, the associated settings are automatically applied by the extension. “Automate everything” is my motto :)
This extension should be useful to open source developers. Typically we work on projects across multiple teams, with different code formatting requirements. The next time you fork a project you can simply open the solution, edit your settings in the normal Tools > Options… dialog to meet the requirements of the team, then export the settings to a new file using the Export Current Settings button on the Settings Switcher toolbar provided by the extension. And that’s it! Every time you open that particular solution, its associated settings are applied automatically.
Project coordinators should also consider checking in a .vssettings file to their repositories. This will make it easier for interested developers to set up their environment for working on your project. A developer would simply need to copy the .vssettings file that you provided to the directory that Visual Studio uses to export settings files on their system (Tools > Options > Environment > Import and Export Settings). Then follow the instructions above to associate the settings with the solution.
I’ve got some additional features that I plan on adding in the future, time permitting. Some of them are very community-oriented. We’ll see how that goes.
Feedback is appreciated. Feel free to request a feature, report a bug or start a discussion.