从命令行安装 VS.NET 扩展

Install VS.NET Extension from Command Line

有什么方法可以从命令行安装 VS.NET 扩展吗?我正在使用 vagrant 和 powershell 设置开发 VM 进行配置,并希望能够自动安装一些我最喜欢的扩展。

您可以使用 VSIXInstaller 自动安装扩展:

Sergey 的回答是正确的,但这是我用来自动化它的 powershell 脚本(从我发现的巧克力包装中偷来的):

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

我使用这个 batch-install-vsix 巧克力包来配置和安装扩展。