Visual Studio (2022) extensions: How to List/Enable/Disable from powershell

Viewed 15

I need to programmatically query what visual studio extensions are installed in Visual Studio 2022 and if they are enabled. Ideally also be able to enable/disable them.

As a hack/example of what I'm trying to do: I can detect if ReSharper is running in a running Visual Studio instance like this

$vsdte="VisualStudio.DTE.17.0"
$dte = [System.Runtime.InteropServices.Marshal]::GetActiveObject("$vsdte")
$dte.Commands | foreach {If ($_.Name.StartsWith("ReSharper")){ $_.Name ;break}}

Resulting in something like ReSharper.ReSharper_ShowFindResults if it does. This does work, but is fragile and requires Visual Studio to be running.

0 Answers
Related