Creating Extensions By Using the VSIX Project Template
You can use the VSIX Project template to create an extension or to package an existing extension for deployment. The VSIX Project template has both Visual Basic and Visual C# versions, and is installed as part of the Visual Studio SDK.
The VSIX Project template consists of the following elements:
The source.extension.vsixmanifest file, which contains information about the extension.
Nota
For more information about VSIX manifests, see Visual Studio Extension Deployment.
A set of icons for the extension.
An empty class file.
Creating an Installable Project Template Extension By Using the VSIX Project Template
The following steps show how to use the VSIX project to package a project template that you can share with other developers or upload to the Visual Studio Gallery.
To create an installable project template extension by using the VSIX project template
Create a project template.
Open the project from which to create a template. This project can be of any project type.
On the File menu, click Export Template. Complete the steps of the wizard.
A .zip file is created in %USERPROFILE%\My Documents\Visual Studio 10\My Exported Templates\.
Create an empty VSIX project by using the VSIX project template.
On the File menu, click New and then click Project. Select either Visual Basic or Visual C#, select Extensibility, and then select VSIX Project.
Add the .zip file to the project. Set its Copy to Output Directory property to Copy Always.
Double-click the source.extension.vsixmanifest file to open it in VSIX Manifest Designer, and then make the following changes:
Set the ID field to MyProjectTemplate - 1.
Set the Product Name field to My Project Template.
Set the Author field to Fabrikam.
Set the Description field to My project template.
In the Content section, add a Project Template content type and set its path to the name of the .zip file.
Save and close the source.extension.vsixmanifest file.
Build the project.
In the output directory, double-click the .vsix file.
A Visual Studio Extension Installer message box appears and asks whether you want to install the extension. Click Install.
When the installation is finished, click Close.
Close Visual Studio and then re-open it.
Open Extension Manager (on the Tools menu). One of the available extensions should be My Project Template.
The project template is installed in the same location as the project type that created it. For example, if you created the template from a Visual Basic console application, My Project Template appears together with the Visual Basic Console Application template.
To Specify the Location of the Template in the New Project Dialog Box
In Windows Explorer, rename the .vsix file to have a .zip extension, and then open the file.
Create a new folder with the same name as the section of the New Project dialog the template should appear in.
If the template is to appear in a subsection, create a subfolder of the same name.
Move the template .zip file into the new folder.
Restore the modified .vsix file to its original name.
Open the VSIX manifest.
Update the Reference Element for the template to point to the root of the directory tree that contains the template .zip file. For example, if the template is in \CSharp\Windows, the reference should point to \CSharp.
Avviso
The names of the top level sections in the New Project dialog do not exactly match the names of the template folders. Where they differ, use the name of the template folder. Template folders are located in the Visual Studio Installation Path\Common7\IDE\ProjectTemplates and Visual Studio Installation Path\Common7\IDE\ItemTemplates directories.
See Also
Reference
Developing Visual Studio Extensions
Change History
Date |
History |
Reason |
---|---|---|
May 2010 |
Added instructions for setting the location of the template in the New Project dialog box. |
Information enhancement. |