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:

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
- 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. - 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. - 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.
- 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. - 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:
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. - 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" }
- 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"
- 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
- 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.
nice this is what i’m looking
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.
@Art: I can’t be 100% certain, but I don’t think so. I would suggest not turning off the UI so maybe you can see where it’s hanging exactly.
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
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)
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.
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 😉
That’s interesting. I always use script wrappers for applications, so perhaps that is the difference.
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
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.
Hi Mathieu,
Could you please give more details what steps and command line you are using?
Thank you for your time.
Regards Nik
Hi,
I tried all the above with community edition , failed ?
Anyone can share the wrapper
Thanks
ps: the comment field broke the line of my bat file — in realit the “vs_setup” command is one long line
Hi Sven, this is the next your guidance that does not work and not clear what exactly you are doing, look at it how many responds you get and people modified a lot that you explain. Seems to me you just through here something and waiting to fixing your issues! I can prove with screen shots an logs that what you exactly write don’t work!!! Waist of time for me and my coworkers reading this. If you wont help do it the right way. If you want receive something give it first.
Hi Nik,
I am sorry this post wasn’t helpful to you. To be clear, I am not looking to “receive” anything from writing these blog posts.
When I write the blog posts, I document as close as possible what I do and how it works in my environment. In this particular post, I left out the fact that I use a script wrapper to install applications using MDT. I had no clue that it makes a difference for the VS 2017 installation. Other commenters have suggested that solution and one event posted a sample script wrapper. I will gladly add your additional solutions to what you’re experiencing if you want to share them in follow-up comments.
Nothing of that is working with VS Professional 2017, so that bath file create only “offline: folder with the folder “certificates” and vs_installer.version nothing else!
Again they are so certain steps are missing or wrong /with the purpose of course / in this article how to build your offline installer.
It is just a waste of time!!!
Nik,
Which workloads and components are you including in the command line? Are they all available in the Professional edition?
Offline folder it is about 36 GB so I run with the same modified jason file you created and failed with error: The source layout directory is too long. The layout directory name must be less than 80 characters.
I try with only .net features and same error.
The error message appears to clearly indicate what the problem is. Have you tried radically reducing the number of characters in the offline folder path, for example, by creating it in c:\VS2017offline?
It is a source directory: .\Applications\Visual Studio Pro 2017
How long is your full UNC path?
D:\DesktopDeploymentShare\Applications\Visual Studio Pro 2017 that is actually full path.
I ‘m using this command line : vs_setup –quiet –nocache –noweb –wait –norestart –in “D:\Applications\VS17\LayoutRsponse.json”
and I receive : Error ENOENT: no such file or directory, opne C:\Program Files9x86)\Microsoft Visual Studio\Installer\LayoutResponse.jason
May I know the silent uninstallation command
when I try with vs_setup uninstall –quiet . Its getting messege box like “are you want to uninstall” . After uninstallation complete, there is one more message like “successfully uninstalled”. how can suppress these messages while uninstallation?
I’d happily share it if I knew it 😀. I have never needed to silently uninstall and I am no longer in a position where I build images, so I don’t have a testbed readily available either.