2

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.

1 Answer 1

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...

Sign up to request clarification or add additional context in comments.

3 Comments

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.
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.
Another approach is to create a vsi with the codesnippets - msdn.microsoft.com/en-us/library/ms246580.aspx (vsix can't deploy code snippets - msdn.microsoft.com/en-us/library/dd393694.aspx )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.