Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to programmatically install a Visual Studio extension?

I have run in to a problem, I need to install an extension in Visual Studio, from code.

For example:

static void OSWindows()
{
    //Install here Extension

    MqttClient client = new MqttClient("");
    //client.Connect("1");

    if (client.IsConnected)
    {
        Console.WriteLine("Is 64Bit OS? " + Environment.Is64BitOperatingSystem);
        Console.WriteLine("Logical Processor Count: " + Environment.ProcessorCount);
        Console.WriteLine("Version: " + Environment.Version);
        Console.WriteLine("System Page size: " + Environment.SystemPageSize);
        Console.WriteLine("Machine Name: " + Environment.MachineName);
        Console.WriteLine("Username: " + Environment.UserName);
    }
}

The app is running on .Net Core. When it starts it finds out if the OS is Linux or Windows, and if it's Windows it should install an extension.

How can I do this?

like image 378
Chookees Avatar asked Dec 07 '25 18:12

Chookees


1 Answers

Visual Studio provides a VSIXInstaller.exe utility (see how to locate it in https://github.com/microsoft/vs-setup-samples).

Then see how to install an extension with that utility and its command-line switch for the SKU (VS edition: Professional, Community, etc.) in my post: Using VSIXInstaller.exe to install programmatically an extension to Visual Studio 2015 and Visual Studio 2017

like image 170
Carlos Quintero Avatar answered Dec 10 '25 06:12

Carlos Quintero



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!