Jake Stevenson
Jake Stevenson

Reputation: 3067

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.

Upvotes: 8

Views: 2763

Answers (3)

Dzmitry Lahoda
Dzmitry Lahoda

Reputation: 939

I used this batch-install-vsix chocolatey package to configure and install extensions.

Upvotes: 0

Jake Stevenson
Jake Stevenson

Reputation: 3067

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

Upvotes: 2

Sergey Vlasov
Sergey Vlasov

Reputation: 27910

You can use VSIXInstaller to automate extension installation:

enter image description here

Upvotes: 5

Related Questions