Is there any way to install a VS.NET extension from the command line? I'm working on setting up development VMs using vagrant and powershell for provisioning, and would like to be able to automate the installation of some of my favorite extensions as well.
You can manually install a VS Code extension packaged in a . vsix file. Using the Install from VSIX command in the Extensions view command dropdown, or the Extensions: Install from VSIX command in the Command Palette, point to the . vsix file.
You can use VSIXInstaller to automate extension installation:
Sergey's answer is correct, but here's the powershell script I used to automate it (stolen from a chocolatey package I found):
function Get-Batchfile ($file) {
$cmd = "`"$file`" & set"
cmd /c $cmd | Foreach-Object {
$p, $v = $_.split('=')
Set-Item -path env:$p -value $v
}
}
function VsVars32()
{
$BatchFile = join-path $env:VS120COMNTOOLS "vsvars32.bat"
Get-Batchfile `"$BatchFile`"
}
function curlex($url, $filename) {
$path = [io.path]::gettemppath() + "\" + $filename
if( test-path $path ) { rm -force $path }
(new-object net.webclient).DownloadFile($url, $path)
return new-object io.fileinfo $path
}
function installsilently($url, $name) {
echo "Installing $name"
$extension = (curlex $url $name).FullName
$result = Start-Process -FilePath "VSIXInstaller.exe" -ArgumentList "/q $extension" -Wait -PassThru;
}
# INSTALL VS Extenaions
installsilently http://visualstudiogallery.msdn.microsoft.com/59ca71b3-a4a3-46ca-8fe1-0e90e3f79329/file/6390/49/VsVim.vsix VsVim.vsix
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With