visual-studiovisual-studio-extensionsnew-item

Visual Studio - Create an Item Template that shows up in the Add New Item dialog for the solution


Visual Studio 2017

I created an Item Template for Visual Studio. When installing the template or running the solution locally, the template only shows up in the Add New Item dialog for a C# project.

I want it to be in the Add New Item dialog for the solution.

It seems to me the problem is having the ProjectType set to CSharp in the .vstemplate file, but I don't know what to set it to. According to the docs the options are only CSharp, VisualBasic, and Web.


Solution

  • Visual Studio - Create an Item Template that shows up in the Add New Item dialog for the solution

    Item template/Project template are for projects rather than solutions and belongs to a specific type of project (such as C# library), that is the reason why you could not add Item template to the solution.

    When you add a new item to a solution using Visual Studio, you'll only see those items that are in General Category. All those files are not "templates", they can be find here :

    C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\NewFileItems
    

    So, if you want to add New Item dialog for the solution, you could add your custom file, like, Test.py, then restart the Visual Studio to add the new item for solution:

    enter image description here

    Hope this helps.