Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install VS.NET Extension from Command Line

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.

like image 683
Jake Stevenson Avatar asked Feb 21 '15 23:02

Jake Stevenson


People also ask

How do I install VS Code extensions in terminal?

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.


2 Answers

You can use VSIXInstaller to automate extension installation:

enter image description here

like image 74
Sergey Vlasov Avatar answered Oct 20 '22 00:10

Sergey Vlasov


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
like image 45
Jake Stevenson Avatar answered Oct 20 '22 00:10

Jake Stevenson