Create .NET Core Template

How to create .NET Core Template and make it installable VSIX in visual studio 2019

Create a Project Template

Step 1: Configuring the Project Template with code

First we need to create a project in Visual studio based on the need like settings configurations, packages and more. Below we have an example of the project which is configured with APM based Micro service.

A console application which enables APM
using Standard.TraceLog;
using System;

namespace APM.Sample
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello APM!");
            TraceLogSetup();

            for (int logCount = 0; logCount <= 10; logCount++)
            {
                Logger.Log.Information("My APM Sample");
                Console.WriteLine(logCount);
            }
            Console.WriteLine("All Set..");

            Console.ReadLine();
        }

        public static void TraceLogSetup()
        {
            //TODO: Trace Log: Please change the configuration based on the project selection
            Logger.AccessKey = "accesskey";
            Logger.SecretKey = "secretkey";
            Logger.Exchange = "APMFrameworkTest_Exchange";
            Logger.ExchangeType = "direct";
            Logger.SSLEnabled = false;
            Logger.PortNumber = 5672;
            Logger.RouteKey = "APMFrameworkTest_Trace";
            Logger.HostName = "10.187.139.233";
            Logger.ProjectName = "XXXXX";
            Logger.ExpireInDays = 30;
            Logger.Setup(AppenderType.APM);
        }
    }
}

The above code has been placed on our project, now this project is the template for the future application.

Step 2: Export as "Project Template"

Now from the visual studio under project menu, select "Export Template" menu.

Export Template

A wizard will open on that select "Project Template"

Select Project Template and the project

Now click on "Next"

Provide the project details

Provide the project details and click on "Finish", now we will get the project template as the Zip File.

Creating VSIX File

Step 1: Create a new Project of project type "Extension", VSIX Project

VSIX Project Template

Step 1: Select the .vsixmanifest file

Double click on the Manifest file and provide the project details as we wish.

Manifest file

Step 2: Supported Visual Studio

Step 3: Asset Selection

Under asset section click on the new button and select

"Microsoft.VisualStudio.ProjectTemplate" and select the zip file which we created during "Project Template creation"

Now build the solution, our VSIX template would be ready for installation.

After installing the VSIX File, we could find the template in our visual studio 2019, as shown below

Custom Project Template

How to Uninstall the existing VSIX package ?

The simple step to uninstall

  1. Go the Visual Studio 2019 Menu, Select "Extension" under that select "Manage Extensions".

  2. Select "Installed" Category, under that find the product and uninstall.

  3. It will be uninstalled during next restart of Visual Studio 2019.

Extension Menu
Click on uninstall

Last updated

Was this helpful?