Difference between revisions of "Creating Project and Item Templates"
m (→Sample Template) |
m (1 revision imported) |
(No difference)
| |
Latest revision as of 14:28, 9 May 2016
You can create custom project templates and project item templates and have these templates appear in the New Project and Add New Item dialog boxes.
Contents
Preparing Projects and Files
Follow this general process to create a template.
- Create a project.
- Add any files you require, and delete files you do not require.
- Modify the files as required.
- Add parameter replacements where appropriate. For more information, see How to: Substitute Parameters in a Template.
- If you have undefined parameters that require user input, or want Visual Studio to perform certain actions when a project or file is created, make a wizard. For more information, see How to: Use Wizards with Project Templates.
- Create the template.
When a user loads your template, he starts with copies of the files in the template, and with substituted parameters resolved.
Template Creation Strategies
There are four ways to create a template in Visual Studio.
Export Template Wizard
The Export Template wizard is a fast way to convert a project or file to a template. Its build output is a compressed file. https://visualstudiogallery.msdn.microsoft.com/57320b20-34a2-42e4-b97e-e615c71aca24
NOTE
If you use vs 2013 then simply export if from File/Export Template menu item
NOTE
To replace namespaces etc. please read https://msdn.microsoft.com/en-us/library/eehb4faa.aspx
Export Template Wizard Extension
The Export Template wizard extension resembles the standard Export Template wizard, except that its build output is a VSIX file, which enables more deployment options. You can download the wizard extension from Extension Manager. For more information, see How to: Use the Template Wizard Extension.
SDK Templates
The Visual Studio SDK includes a Project Template template and an Item Template template. These templates include some default parameter substitutions, and build out to compressed files. We recommend the SDK templates for extensions that have multiple templates that require version control, and for scenarios that are not supported by the Export Template wizard.
Manual Creation
You can manually create a template by developing the required files and then packaging them into a compressed file. For more information, see How to: Manually Create Project Templates and How to: Manually Create Item Templates.
Sample Template
http://s3k.me/files/Greenfield_MVC_MySQL.zip
download and copy this file under C:\Users\Logicmade\Documents\Visual Studio 2013\My Exported Templates