How to: Manually Create Web Templates
Creating a Web template is slightly different than creating other types of templates. Because Web project templates appear in the Add New Website dialog box, and Web project items are categorized by programming language, the .vstemplate file must specify the template as a Web template and identify the programming language.
Note
Web templates must contain a empty .webproj file that is specified with the File attribute of the Project element. Although Web projects do not require project files, this file is required for proper functionality of Web templates.
To manually create a Web template
Create a Web project.
Modify or delete the files in the project, or add new files to the project.
Create an XML file and save it with a .vstemplate extension in the same directory as your project, but do not add it to the project in Visual Studio.
Author the .vstemplate XML file to provide project template metadata. For more information, see the example in the following section.
Locate the ProjectType element in the .vstemplate file, and set the text value to Web.
Following the ProjectType element, add a ProjectSubType element and set the text value to the programming language of the template. The programming language can be one of the following values:
CSharp
VisualBasic
JSharp
For example:
<TemplateData> ... <ProjectType>Web</ProjectType> <ProjectSubType>CSharp</ProjectSubType> ... </TemplateData>
Select the files included in your template (including the .vstemplate file), right-click, select Send To, and click Compressed (zipped) Folder. The files that you previously extracted are compressed into a .zip file.
Place the .zip template file in the Visual Studio project template directory. By default, this directory is My Documents\Visual Studio 2008\My Exported Templates\.
Example
The following example shows a simple .vstemplate file for a Web project template.
<VSTemplate Version="2.0.0" Type="Project"
xmlns="https://schemas.microsoft.com/developer/vstemplate/2005">>
<TemplateData>
<Name>MyWebProjecStarterKit</Name>
<Description>A simple Web template</Description>
<Icon>icon.ico</Icon>
<ProjectType>Web</ProjectType>
<ProjectSubType>CSharp</ProjectSubType>
<DefaultName>WebSite</DefaultName>
</TemplateData>
<TemplateContent>
<Project File="WebApplication.webproj">
<ProjectItem>icon.ico</ProjectItem>
<ProjectItem OpenInEditor="true">Default.aspx</ProjectItem>
<ProjectItem>Default.aspx.cs</ProjectItem>
</Project>
</TemplateContent>
</VSTemplate>
See Also
Tasks
How to: Manually Create Project Templates
Reference
Visual Studio Template Schema Reference