This seems like a trivial task. And it is. Still it’s not easy to find where and what should be changed or to find it explained on MSDN. Even searching it on Google will not easily help.
Once your template project is added, and no matter if it is a project template or an item template, you will find your .vstemplate file. If you right click on the template file and choose properties, you will get to the following screen.

TemplateCategory

As you can see from this picture, there is a property called Category and it is the one to be set.

The result will be the following (in case of an Item Template):

AddNewItemTemplateInCategory

In case you have problems seeing your changes, make sure you cleaned and rebuilt the solution and that you reset your VS Experimental instance. More details about this procedure can be found here

Note that I had trouble with this approach on Visual Studio Ultimate 2015 Preview (Version 14.0.22310.1 DP) and I already notified a possible bug to Microsoft. It works as expected on VS 2012 and 2013.

In case your Visual Studio Item Template project contains multiple item templates and that you want to have a single place for editing the categories, you can make use of the following technique.

Unload your project and edit the project file. Inside your main PropertyGroup define a new MSBuild property and call it TemplateCategory (or any other name you wish).
Your code should look something like this:



  
    ...
    StyleCop Analyzers
  

Now in the same file search for all of the references to your VSTemplate files and change them in the following way:


      $(TemplateCategory)
      Designer

Now repeat the same for all the templates you would like to be a part of the group you just defined. In case the group name is going to change, you will need to edit only a single place in your project file.

This can be useful in case you are managing a substantial number of templates and you are changing categories based on your product version.

Cheers

Related Post

One thought on “Custom category for Visual Studio templates”
  1. Oh my goodness thanks for that! I’ve spent a good hour or so trying to figure out where this is configured.

Leave a Reply

Your email address will not be published. Required fields are marked *