Silent, Offline Install for Visual Studio 2017 Enterprise with MDT

It’s time to start preparing a new thick image for the computer labs. There are some interesting changes that need to be made this go-around, including a solution for Installing Office 2016 (VL, MSI) together with Visio and/or Project 2016 (click-to-run, C2R): Deadlocked, but I will write about that later. This post is about Visual Studio 2017 and its new installer technology.

Visual Studio 2017 uses a different installation concept than previous versions. Rather than installing a (large) number of discrete components, components are now grouped into “workloads.” These workloads include Azure, Managed Desktop, ASP.NET development, etc. Installations are customized by selecting one or more workloads with recommended and optional components. The installer UI looks like this:

2017-05-09_14-25-43
The Visual Studio 2017 Installer UI showing available workloads.

This new installer also changes how silent and offline installations are created and performed. Some concepts, such as creating a layout folder, are still around. Others, such as the terse XML from the AdminDeployment.xml file, are history.

Documentation on performing such custom installs is spread across a number of different docs, so here is my attempt at creating a step-by-step unified process for creating your offline layout and a command-line for actually deploying it.

1. Create Your Offline Layout

  1. Download the setup bootstrapper for your edition. I will be using Enterprise, so the file I will be working with is vs_enterprise.exe. Depending on your download source, you might end up with vs_edition_lotsofnumbers.exe. Remove the _lotsofnumbers part from the file name before you continue.
  2. Determine which workloads and recommended or optional components you want to install. I only download those that I will actually install. That’s still a hefty download but it saves a little space at least.
    You will find the complete list of workloads and component IDs at https://docs.microsoft.com/en-us/visualstudio/install/workload-and-component-ids.
    I am not going to take up space in this post listing the components I install. What I did, as you’ll see from the command below, is getting the workloads I need, including all recommended and optional components and then added a few extra components.
  3. Create a batch file. This is optional but considering you’ll be re-using this command every time you want to update your offline layout, this is a good idea. I create the offline layout in a subfolder of my current directory called “offline.” Naming does not matter in this case. My batch file has one simple command:
vs_enterprise.exe --layout .\offline --lang en-US --includeRecommended --includeOptional --add Microsoft.VisualStudio.Workload.Azure --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NetCoreTools --add Microsoft.VisualStudio.Workload.NetWeb --add Microsoft.VisualStudio.Workload.Data --add Microsoft.VisualStudio.Workload.NetCrossPlat --add Microsoft.VisualStudio.Workload.WebCrossPlat --add Component.GitHub.VisualStudio --add Microsoft.VisualStudio.Component.TestTools.CodedUITest --add Microsoft.VisualStudio.Component.TestTools.Core --add Microsoft.VisualStudio.Component.TestTools.FeedbackClient --add Microsoft.VisualStudio.Component.TestTools.MicrosoftTestManager --add Microsoft.VisualStudio.Component.TestTools.WebLoadTest --add Microsoft.VisualStudio.Component.TypeScript.2.0

NOTE: In order to add multiple workloads and/or components in a single command, you need to put --add in front of every workload component. This is not apparent from several samples I have seen.

  1. Execute your command. Sit back and relax, the download will take a while. Using the same command above, my offline layout folder is 10.6 GB.
    PRO TIP: If there is a glitch during the downloads, one or more components may not download but the command will appear to have succeeded. This will be reflected in the log file, but you may just want to run your command until you see no additional component downloads taking place.
  2. Copy the contents of the “offline” folder to the location where you will actually install it from. This will vary based on your deployment method.
    This copy is best because every time you re-execute the command, the response.json file gets overwritten. The installer does create a backup copy for you.
    PRO TIP: Some of the files in the layout folder are very long and when copying, you may get this warning from File Explorer:
    2017-05-09_15-43-00
    Yes, it’s 2017 and we’re still dealing with this. I have found that when copying on the server rather than from the client, this issue is resolved.
  3. Locate the response.json file in your layout folder. This file is the new auto-answer or response file; it takes the place of AdminDeployment.xml from VS 2015 and prior. Open it with a text editor. It’s not formatted “pretty,” so I use Notepad++ and the JSON Viewer plugin to format it first.
{
    "installChannelUri": ".\\ChannelManifest.json",
    "channelUri": "https://aka.ms/vs/15/release/channel",
    "installCatalogUri": ".\\Catalog.json",
    "channelId": "VisualStudio.15.Release",
    "productId": "Microsoft.VisualStudio.Product.Enterprise"
}
  1. Add a comma at the end of the “productId” line and then add the following lines to create a silent installer that will include the recommended and optional components for the selected workloads. I have also included my VL product key. Note that at this time, due to a bug, both at the command line and in the JSON file, you must remove the hyphens from the product key.
"includeRecommended": true,
"includeOptional": true,
"productKey": "AAAAABBBBBCCCCCDDDDDEEEEE"
  1. Add another comma at the end of the “productKey” line and then add your language(s) and workloads and components.
    Tip: Copy and paste the workload and component IDs from your batch file to avoid typos.
"addProductLang": [
		"en-US"
    ],

    "add": [
	"Microsoft.VisualStudio.Workload.Azure",
	"Microsoft.VisualStudio.Workload.ManagedDesktop",
	"Microsoft.VisualStudio.Workload.NetCoreTools",
	"Microsoft.VisualStudio.Workload.NetWeb",
	"Microsoft.VisualStudio.Workload.Data",
	"Microsoft.VisualStudio.Workload.NetCrossPlat",
	"Microsoft.VisualStudio.Workload.WebCrossPlat",
	"Component.GitHub.VisualStudio",
	"Microsoft.VisualStudio.Component.TestTools.CodedUITest",
	"Microsoft.VisualStudio.Component.TestTools.Core",
	"Microsoft.VisualStudio.Component.TestTools.FeedbackClient",
	"Microsoft.VisualStudio.Component.TestTools.MicrosoftTestManager",
	"Microsoft.VisualStudio.Component.TestTools.WebLoadTest",
	"Microsoft.VisualStudio.Component.TypeScript.2.0"
    ]

I have posted the complete Response.json as a Gist: https://gist.github.com/SvenAelterman/a743bd142a3d6fa8af311ebdc4fcb172

  1. Save the response.json file.

2. Create the Silent Install Command

While these command line switches can be specified in the response.json file, the bootstrapper doesn’t read the JSON file. So these parameters below are best kept in the command line:

vs_enterprise --quiet --nocache --wait --in <path to json>

Miscellaneous

I don’t use the offline layout for distributing updates, but that is supported should you want that.

Advertisements

One thought on “Silent, Offline Install for Visual Studio 2017 Enterprise with MDT

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s