Where are your Visual Studio toolbox code snippets stored? And how would you import and export them?
Posted: (EET/GMT+2)
Sounds like an age-old question, but I recently wanted to find a the best solution to this problem, and found out that most of the forum post suggestions are simply wrong: they say it cannot be done.
But let's rewind to the beginning. You have an older Visual Studio version (say, 2010) and want to migrate to something newer, like 2012 or 2013 even (once here). You have collected lots of useful code snippets (officially, "toolbox text items") onto your Toolbox window and you want to make them available in your next Visual Studio version.
Two easy solutions are available, and a third one, which is obviously the most interesting one. Let's take the simplest ones first. Firstly, when you install a new Visual Studio version *on the same computer* as your previous Visual Studio version, you can simply after the installation launch Visual Studio for the first time, and then choose to migrate your settings from the old version. Simple as that.
Secondly, you could use the "Import and Export Settings" command from the Tools menu. Select to export only the settings under General/Toolbox, and then import these back into your new Visual Studio version. The file used is the Visual Studio settings file, which has the extension of .vssettings. It is an XML file, and lives by default under "Documents\Visual Studio NNNN\Settings.
Thirdly, which would be my favorite, would be to write some PowerShell scripts to first extract all data from the previous Visual Studio version's settings file, and then merge these with the latest Visual Studio version. In case you are interested, look for the "<PropertyValue name='Item0.Data'>" tags in your settings file. If you have more than one item, you will find nodes named Item0..Item999 available in the file, up to the number of custom items you have (say, 999).
Good luck!