I'm currently creating a Visual Studio Add-In and require the ability to add a location for custom Code Snippets to the users Visual Studio Environment programatically. I'm aware of the DTE Command Tools.CodeSnippetsManager but don't know if there are command argurments which allow me to add these locations.
Asked
Active
Viewed 302 times
1 Answers
1
If you placed you snippets in either:
"%USERPROFILE%\Documents\Visual Studio 2010\Code Snippets"
Or if you want them only for C#...
"%USERPROFILE%\Documents\Visual Studio 2010\Code Snippets\Visual C#\My Code Snippets"
plus you can change "Visual C#" to "Visual Basic" "SQL" or "XML" or "Visual Web Developer" respectively.
and use File.Copy to get them to the right location...

Stephen Gennard
- 1,910
- 16
- 21
-
The second option is what I have been reduced to doing, along with similar locations for vb, sql, xml, html and jscript. However, as a product it would be prefereable if they didnt appear under the heading "My Code Snippets" in the snippet command sequence within VS. – gouldos Feb 22 '11 at 14:27
-
The first option will only appear using CtrlK-X if you use the Code Snippets Manager to register them which is essentially what I was trying to find an API for. – gouldos Feb 22 '11 at 14:30
-
Another approach is to create a vsi with the codesnippets - http://msdn.microsoft.com/en-us/library/ms246580.aspx (vsix can't deploy code snippets - http://msdn.microsoft.com/en-us/library/dd393694.aspx ) – Stephen Gennard Feb 23 '11 at 15:21