Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update Visual Studio 2017 using command line?

I'd like to automatically update my Visual Studio 2017 installation from a script (running this script at session login).

vs_installer shows a bunch of command line arguments (using /?). So I tried :

& "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" update --passive --norestart

However, nothing happens. I see the process in the task manager for a few seconds, but the product is not updated.

How to update my VS installation ? Is is possible to handle the installer update ?

PS: if possible, I'd to have a passive update, not an invisible update. I'd prefer seeing the product being updated to avoid launching a new instance while the update is in progress.

like image 426
Steve B Avatar asked Feb 21 '18 08:02

Steve B


People also ask

How do I update Visual Studio from terminal?

If you have already installed VS code, go to the terminal and type two different commands: sudo apt update. sudo apt-get upgrade code.

How do I upgrade Visual Studio to latest version?

You can also manually check for updates by running Help > Check for Updates on Linux and Windows or running Code > Check for Updates on macOS. Note: You can disable auto-update if you prefer to update VS Code on your own schedule.

How do I run a command-line in Visual Studio?

Open Visual Studio. On the menu bar, select Tools > Command Line > Developer Command Prompt or Developer PowerShell.


1 Answers

I found partially the answer. I have to specify the install path of visual studio to let the installer knows what to update:

& "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" update --passive --norestart --installpath "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise" (assuming default path).

I still have to look for updates of the installer itself, but since I've the latest version, I've to wait for a new release.

[Edit 04/10/2019] The update process is similar with VS 2019 (at least from 16.0 to 16.0.1). I can update both version using :

Start-Process -Wait -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList "update --passive --norestart --installpath ""C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise"""
Start-Process -Wait -FilePath  "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList "update --passive --norestart --installpath ""C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise"""

I use Start-Process with -Wait to avoid returning control before the end of the update.

like image 53
Steve B Avatar answered Sep 21 '22 03:09

Steve B