Steve B
Steve B

Reputation: 37710

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.

Upvotes: 15

Views: 13229

Answers (1)

Steve B
Steve B

Reputation: 37710

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.

Upvotes: 25

Related Questions