Extending Visual Studio Templates
Visual Studio comes with multiple project templates for each technology. But, you may need to create your own to include the files and folders you want. Fortunately, and as any excellent IDE, VS can help you make your personalized template. If you wonder how we can do it, then you might be interested to continue reading this tip.
Let's suppose you have a project containing your own folders and files. To create the project template, you'll need to go through the following 2 steps:
1. Exporting the Project
You open your project with Visual Studio, then go to File and select Export Template.
Once done, the following dialog will show up asking what type of template you want to make. Go and select Project Template and select the specified project if you have more than one in your solution.
Then another dialog will appear asking for an icon and the template name and description. When clicking Finish, the project template will be created and exported to Documents\Visual Studio 2013\My Exported Templates as a zip file.
2. Creating the VSIX
In this step, you will need first to have Visual Studio SDK installed. You can download it from here: http://www.visualstudio.com/downloads/download-visual-studio-vs.
When creating a new project, you will have an item called Extensibility
, click it and select VSIX Project.
From the vsixmanifest
dialog, select option Asset and click New. Here is where you want to get the exported project and make it a project template. To do so, choose Project Template for the Type and browse to the path of the previously exported project. Then click Build and the vsix file will be created at the Debug or Release folder of your VS project.
How to Test It ?
To test it, you may hit Start from VS, that will start a new experimental instance of VS, which has the extension pre-installed. Alternatively, you can double click the vsix, install it and fire up a new instance of VS. Now you will see your template appearing on the New Project dialog in VS!
Publish It to VS Gallery
The vsix extension you have created could be published to the Visual Studio Gallery to make it available for anyone using VS. To do that, you should go to https://visualstudiogallery.msdn.microsoft.com.