Freigeben über


Organizing Your Custom Item Templates

Versions:  2008,2010
Published:  11/9/2010
Code:  vstipProj0020

 

In vstipProj0013 (https://blogs.msdn.com/b/zainnab/archive/2010/08/17/roll-your-own-item-template-with-the-export-template-wizard-vstipproj0013.aspx) I showed you how to create custom item templates.  What I didn't show you was how to organize them.  It's actually pretty easy.  Once you have created your template go to C:\Users\<user>\Documents\Visual Studio <version>\Templates\ItemTemplates.  In my case, I'm going to "C:\Users\zainnab\Documents\Visual Studio 2010\Templates\ItemTemplates":

image

 

 

As you can see I have a custom class called "Really Cool Regex Class".  Unfortunately, when I go to use it and bring up the Add New Item (CTRL + SHIFT + A) dialog it shows up in the root list:

image

 

 

But not in the "Code" area:

image

 

 

To get the custom template to show up here I just need to go back to the C:\Users\<user>\Documents\Visual Studio <version>\Templates\ItemTemplates directory and create a new folder called "Code":

image

 

 

Then move the custom template into the folder:

image

 

 

That's all there is to it.  Now whenever I go to add a new item (CTRL + SHIFT + A) I can see my custom template in the "Code" section:

image