Multiple CodeSnippet in an XML .snippet file

Posted by Frinavale on Stack Overflow See other posts from Stack Overflow or by Frinavale
Published on 2009-07-28T18:50:07Z Indexed on 2010/04/12 15:03 UTC
Read the original article Hit count: 618

I'm attempting to supplement the help features for my code by providing other developers with code snippets. These produce skeletons of code which demonstrate how to use/call my classes or methods.

I've created a .snippet file and have placed it in the "%Visual Studio Folder%\Code Snippets\Visual Basic\My Snippets" folder. I've used the Code Snippets Manager and ensured that it included this folder so that I can access the snippets.

Everything works well when I have 1 CodeSnippet tag within the root CodeSnippets tag....

When I add more than one CodeSnippet tag to the file (each with their own title, and their own code example) I'm experiencing something strange.

The first CodeSnippet I've added contains code for adding something to my system, the second contains code for editing something in my system, and the third deleting something from the system.

When I use the code snippet by right clicking and selecting "Insert Code Snippet", only the first code snippet in the file shows up as an option. When I select it, the code in the first CodeSnippet is inserted....but so is the code within the other CodeSnippet tags.

Do you have to have a separate XML .snippet file for each code snippet you want to make available?

After reading through MSDN about creating Code Snippets I was under the impression that this could all be done within one file.

It seems that I'm not understanding something very basic here and would love to find the answer but apparently Code Snippets are under used so finding the answer has proven to be a little trickier than I first thought it would be.

Thanks,

-Frinny

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about code-snippets