Automated Installation Options for Visual Studio 2015

A colleague asked me this question recently:

Are you able to point me at a way to script VS installation so I can do unattended and pick the C++ and UWP features? Bonus points if it can install extensions as well (but not essential)

The Visual Studio setup options are documented on MSDN, but the specific incantation is not immediately obvious. Here are the three most relevant switches:

  • For unattended, use /quiet (or /passive if you want to show the UI but not prompt)
  • To install optional components, use /InstallSelectableItems [item1; item2; ...]
  • To prevent reboot at the end, use /norestart (or use /forcerestart to require reboot)

OK – but how do I know what items to install? That’s the magic secret sauce. The optional components available for installation into Visual Studio are retrieved dynamically at runtime from an ATOM feed, enabling us to change and update this repeatedly.

So for a silent unattended install of Visual Studio plus Windows 10 developer components, you'd want something like this:

  vs_enterprise.exe /quiet /installselectableitems Windows10_Group; NativeLanguageSupport_Group;CommonTools_Group

What if I'm running this from a batch file and I want to know when this command has completed? Use the start.exe command to block synchronously:

  start /wait vs_enterprise.exe /quiet /installselectableitems Windows10_Group; NativeLanguageSupport_Group;CommonTools_Group

How about the bonus points request of being able to install extensions? From the command line, you can use a command like this:

  VSIXInstaller.exe /q /i "Name of VSIX.vsix"

VSIXInstaller.exe is typically in the C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ directory on a machine with VS2015. Running it with no arguments will give you help on command-line switches.

One last thing. By design, the Visual Studio installer is a connected experience - because it wants to ensure that you have the latest version of each component. But what if you want to cache the installation bits locally so you can apply it to multiple machines? In the past, we used to supply an ISO disc image - and while we still do, it doesn't contain some of the third-party components that we make available. So instead, you can run something like:

  vs_enterprise.exe /full /layout c:\vs2015

to cache the full installation bits locally. You can now mount the resulting folder on a network share to minimize internet bandwidth. As we keep publishing new updated content (e.g. updates to Cordova or ASP.NET), you can rerun the same /layout command on the cache directory to keep it synced: it will add new components that have been included in the ATOM feed.

Hope this helps a few folk...