How to: Publish Project Templates
For a template to appear in the New Project dialog box, it must be installed in the correct location on the computer. To make this process easier, you can put your template .zip file in a Visual Studio Installer (.vsi) file, and then let the Visual Studio Content Installer put the template in the correct location. By using a .vsi file, you can also share your template (or other components for Visual Studio) with other developers.
.VSI Files
A .vsi file is .zip file that has a renamed file name extension. .Vsi files contain the following:
An .xml file that describes the content. This file must have the file name extension .vscontent, and must follow a specific XML schema. For a complete definition of the .vscontent XML schema, see How to: Package Community Components to Use the Visual Studio Content Installer.
The content files, for example, a template .zip file. For information about creating template .zip files, see Creating Project and Item Templates.
For more information about how to install .vsi files, see How to: Install Community Components.
You must set specific values and attributes in the .vscontent file for your template so that the Visual Studio Content Installer will know how and where to install it. In the .vscontent file for a template, you must do the following:
Set the value of the FileContentType element to VSTemplate.
Add an Attribute element that has the following attributes:
ProjectType attribute: Specifies the project type, either Visual Basic, Visual C#, or Visual Web Developer.
ProjectSubType attribute: Specifies the subcategory in which to show the template in the New Project dialog box.
TemplateType attribute: Specifies the type of template, either Project or Item.
To create a template .vsi file
Create a valid .vscontent file for the content. For more information about the .vscontent file schema, see How to: Package Community Components to Use the Visual Studio Content Installer.
Select the .vscontent file and the other files you want to include in the .vsi file. Right-click the selection, click Send To, and then click Compressed (zipped) Folder. The selected files are compressed into one .zip file.
Rename the file name extension of the .zip file to .vsi.
Note
To display publisher information about your project template in the Visual Studio Content Installer, you must sign the .vsi file. For more information, contact a Digital Certificate vendor.
Example
The following example shows the .vscontent file for a .vsi file that contains a project template. The following files would be included in the .vsi file for this content:
A .vscontent file that contains the code from this example.
A project template, MyProjectTemplate.zip.
In this example, the template would be installed in the root Visual Basic category of the New Project dialog box. If you wanted to install the template in a Visual Basic subcategory, you would specify the subcategory name as the value of the ProjectSubType attribute.
Note
The following example uses a ContentVersion element value of 2.0. If a project template can be used by either Visual Studio 2005 or Visual Studio 2008, use a value of 1.0. If a project template is specific to Visual Studio 2008, use 2.0.
<VSContent xmlns="https://schemas.microsoft.com/developer/vscontent/2005">
<Content>
<FileName>MyProjectTemplate.zip</FileName>
<DisplayName>Sample Project Template</DisplayName>
<Description>A project template created for this example.</Description>
<FileContentType>VSTemplate</FileContentType>
<ContentVersion>2.0</ContentVersion>
<Attributes>
<Attribute name="ProjectType" value="Visual Basic"/>
<Attribute name="ProjectSubType" value=""/>
<Attribute name="TemplateType" value="Project"/>
</Attributes>
</Content>
</VSContent>
See Also
Tasks
How to: Package Community Components to Use the Visual Studio Content Installer