Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Distribute Visual Studio Templates With Extensions Installer

DZone's Guide to

Distribute Visual Studio Templates With Extensions Installer

In the article, we talk about how you can distribute the project/item templates you created among your peers.

· Integration Zone ·
Free Resource

The Future of Enterprise Integration: Learn how organizations are re-architecting their integration strategy with data-driven app integration for true digital transformation.

History

While working on the Bellatrix project, we wanted to find ways to solve all 40+ problems in the best possible way. There were a couple of things that we had to address — distribute the getting-started projects (the so-called starter-kits) across all platforms and give people a fast way to create new Bellatrix test projects.

So, we used three different solutions for test project creation — Visual Studio project templates, .NET Core templates, and custom-made cross-platform templates. One of the ways for deploying the Bellatrix item and project templates was through Visual Studio extensions installers. Here I am going to share with you how you can use them too.

Create VSIX Project Template

Prerequisites

To find the VSIX project template, you must install the Visual Studio SDK.

1. Click Tools > Get Tools and Features...

Get Tools and Features Menu Visual Studio

2. From the Visual Studio Installer, install Visual Studio extension development

Visual Studio Installer VS extension development feature

Create VSIX Project

1. Open New Project wizard

2. Create new empty VSIX project

Create Empty VSIX Project

3. Create a desired item or project templates

For more information on how to speed up tests writing, check the last four articles in the series:

Standardize Page Objects with Visual Studio Item Templates

Create Multiple Files Page Objects with Visual Studio Item Templates

Speed up Automated Tests Writing with Visual Studio Project Templates

Speed up Automated Tests Writing with .NET Core Project Templates

The item and project templates are zip files.

4. Copy templates' zip files to the new project directory

5. Set Copy to Output Directory build action to Copy Always

Copy to Output Set to Copy Always

6. Open source.extension.vsixmanifest file

7. Populate the information about the installer

Populate VSIX installer information

8. Add the template's zip to Assets based on the type of the template.

Choose Type Assets VSIX

8.1. In our case, we choose Microsoft.VisualStudio.ProjectTemplate, but you can pick a type for item template or snippet.

8.2. For the source, browse to the file that we added to the project.

Template File Path VSIX Installer

9. Set prerequisites for the VSIX installer, which version of Visual Studio will be supported. By default, the latest two versions are set.

VSIX Prerequisites

10. Build your project

InstallVSIX Extension

After you build your project, a new *.vsix file is generated in the bin folder. You double click on it, and the template will be installed on your machine.

Install VSIX Extension

You need to close all instances of Visual Studio or the installation will happen on the next restart of the tool.

After the extension is installed, you can create a new project from the extracted template.

Create Project from Installed VSIX Project Template

Uninstall VSIX Extension

From Tool -> Extensions and Updates you can find all installed VSIX extensions. From there you can uninstall the extension.

Uninstall VSIX extension

Summary

In the article, we talked about how you can distribute the project/item templates you created among your peers. It is a convenient way to speed up tests writing and applying common team's coding/quality standards.

Make your mark on the industry’s leading annual report. Fill out the State of API Integration 2019 Survey and receive $25 to the Cloud Elements store.

Topics:
integration ,tutorial ,vsix ,bellatrix project ,visual studio templates ,extensions installer

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}