Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio toolbox code snippet

Hi I am trying to create code snippets in my tool box. I dragged code from my code view to toolbox, renamed snippet code to name exSnippet1.

I am trying to find out

-- > Instead of dragging and dropping Can I add code snippets to toolbox dynamically through code to below file ?

..\My Documents\Visual Studio 2010\Settings\CurrentSettings.vssettings

To summarize, I want to create toolbox with code snippets as controls and want to share the toolbox controls to my team for reuse. When I add a codesnippet to toolbox by gragging and dropping, i see the code in currentseetings.vssetting file. What would be the best option to share my toolbox controls to team. Editing vssettings file is not preferred as per this.

Any link which can guide me or any idea would be highly appreciated.

Elaborating little more: 1. I added a few code snippets by dragging and drooping to toolbox 2. I see the code snippets info in my local folder with a file named currentsettings.vssettings 3. I shared my currentsettings.vssettings file with one team member and he used tools/import export and imported this file to get my code snippets on his machine. 4. Do we have any other option than doing the import process? because the current setting file overrides his settings and also he may use other versions of visual studio. 5. I am trying to check if there is any option so that only code snippet part will be imported to his toolbox.

like image 395
Kurkula Avatar asked Dec 24 '13 17:12

Kurkula


1 Answers

Calling it a "snippet" is a great misnomer. The toolbox simply acts like a clipboard in this scenario. It stores bits of text, nothing more. It is automatable, you use the Toolbox interface in a VS add-in. They are stored in a ToolBoxTab named "Clipboard". It can only store 15 of them, doesn't scale at all. Really rather best to leave it to the programmer for his own use.

If you want to create snippets then do just that. Plenty of help around, like the Snippy snippet editor or this snippet designer add-in in the gallery. The MSDN walkthrough page is here.

like image 172
Hans Passant Avatar answered Oct 10 '22 17:10

Hans Passant