How can i load a template I have created in Visual

2020-03-08 08:18发布

问题:

After creating a solution for a project, I exported it as a template. Now after exporting it automatically adds the template to my IDE and creates a ZIP file with all the project files and a .vstemplate extension file.

Now i am on another computer with visual studio and i wish to load this template and save it in the IDE, but i cannot find this option anywhere. The temporary solution i have is to open an empty web application and copy all the contents of the ZIP file not including the .vstemplate file. So my question is how can i load this template into my IDE?

When opening the vstemplate file in Visual Studio all i get is a text editor and XML data.

I am using Visual studio 2013 with Update 4.

回答1:

Once you've exported your template, copy the entire ZIP file that was created to the folder C:\Users\[User Name]\Documents\Visual Studio 2013\Templates\Project Templates. (You might want to use one of the provided subdirectories to keep your template organized.)

Restart Visual Studio, and then use the search bar in the New Project dialog to help you find the project template you just added.



回答2:

For the record, it looks like using templates changes with VS2017. Your project template provider will have to publish via a new build mechanic, and it'll be a bit different than just dumping a .zip into a user folder:

Using Project/Item Templates: https://docs.microsoft.com/en-us/visualstudio/extensibility/upgrading-custom-project-and-item-templates-for-visual-studio-2017

Create Project/Item Template: https://docs.microsoft.com/en-us/visualstudio/extensibility/creating-custom-project-and-item-templates