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

11 thoughts on “Silent, Offline Install for Visual Studio 2017 Enterprise with MDT

  1. Is there a minimal set of workloads required? I have tried following this guide to set up a silent install with MDT but the install just hangs partway through the process.

      1. Hmm. Took out the “–quiet” option and redid it.
        My install command is “vs_enterprise.exe –nocache –wait –in Response.json”

        – It popped up a “click okay to approve privacy policy” window, and then it popped up a big error window about not being able to find the Response.json file — this was partway the install, so it’s odd. I think it was a finalize install app — sorry, did not get a screen shot. Something is not getting passed along, or it is choking on the volume mount where the install is located somehow. Hmm. I’ll keep poking at it!

        thanks
        …art

      2. I had this error too for the Response.json file and it seems that we will need to provide the full UNC Path to the file in MDT.

        But now, I’ve the problem with my install path being too long (more than 80 caracters)

      3. Can you post your command line? I’ve also tried it by specifying the complete path
        (both via something like \\129.128.1.2\folder\file.json” or “S:\folder\file.json” but both fail.

      4. I’ve used this command :

        vs_setup.exe –quiet –nocache –wait –in “Z:\Applications\L3324_Visual Studio 2K17\Response.json” (I removed the UNC path because of the length path at the installation)

        I’ve tried this manually and it was working fine but in MDT it cause me trouble to install (I don’t know why) so I’ve made a .bat file with this command Inside and I can now inst it in MDT by telling the APPS to run the .bat file 😉

  2. Thank-you, Thank-you, Thank-you!!!! Saved my bacon.

    To sum up
    1) you need to specify the full path for the response.json file
    2) you need to run the visual studio install from a script, as it FAILS if you try have MDT run the install directly itself.

    So in the MDT applications configuration window I set the “Quiet install command” to be “install.bat”

    Then in my Application folder I created an install.bat which contains this:

    @ECHO OFF
    REM ===================================================
    REM Installer batch script for Visual Studio
    REM ===================================================
    vs_setup –quiet –nocache –noweb –wait –norestart –in “Z:\Applications\VisualStudio2017\uwo.json”

    REM 3 second pause…
    TIMEOUT /T 3 /NOBREAK

    REM Done?
    EXIT /B

    This is workable, though awkward. Normally you could just go into MDT to tweak the installation command line, but now you need to dig deeper to locate and update the install.bat file.

    But the real annoyance is that this takes a 30-45 minute system installation and turns it into a 2-3hour installation. But that is because this package is a huge massive pig.

    Thanks again for your help. Hope this helps other people also who are trying to use MDT to image their systems!

    …art

    1. It’s exactly how I finished to be able to install VS 2K17 in MDT. And like you, it take easely 30 minutes or more. And I don’t install everything, just 3 components (for .NET with VB). If it’s the way to make it work, I’m ok with it.

  3. ps: the comment field broke the line of my bat file — in realit the “vs_setup” command is one long line

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