[TBS_BUTTON color="success" style="text-decoration:none" link="http://www.dwmkerr.com/wp-content/uploads/2013/02/SwitchSetup.zip" title="Download Switch Installer"]Download Switch Installer[/TBS_BUTTON]
Switch is an Addin for Visual Studio 2008, 2010 and 2012 that lets you quickly switch between related files. Typically you set up the Switch command somewhere easily accessible, and then just hit it everytime that you want to flick between related files. Here’s some examples of what it’ll switch between:
- C++ Files (cpp to h etc).
- WinForms Code-behind and Designer
- WPF/Silverlight/Windows Phone XAML and Code-behind
- ASPX Markup and code-behind
- Interface and implementation
Visual Studio 2012 Issues
Some people have noticed that if they had the Visual Studio 2012 RC installed and then upgraded to RTM, then the installation doesn’t work for VS 2012. In this case, move the files from the Addins folder of the ‘Visual Studio 2012′ folder in your Documents directory to the ‘Addins’ folder of the ‘Visual Studio 11′ folder.
Creating a Keyboard Shortcut for Switch
To set a keyboard shortcut for the Switch command, follow these steps:
- In Visual Studio, you go to Tools > Customise.
- On the dialog that appears, choose ‘Keyboard…’.
- Now you have the options page open in the Keyboard section, in the ‘Show commands containing’ box, type in ‘switch’.
- In VS2010, you’ll see a command named ‘Switch2010.Connect.Switch2010′, in VS 2012 you’ll see ‘Switch2012.Connect.Switch2012′ – select the command and then in the box under the text ‘Press shortcut keys’, enter your shortcut key. Now press ‘Assign’ and OK.
If you go to Tools > Options, you’ll see a ‘Switch’ section. This section allows you to configure what you can switch between:
The code for Switch is available on GitHub, use the buttons below to watch, fork or follow.
Switch is available on the Visual Studio Gallery: http://visualstudiogallery.msdn.microsoft.com/e50c0328-97a1-4842-8821-f0a82640245a
There’s an article on the CodeProject describing how to create Visual Studio Addins – this article describes how Switch was created: http://www.codeproject.com/Articles/324611/Extending-Visual-Studio-Part-2-Creating-Addins