A new day in paradise! Microsoft has no ISO file for the new Visual Studio 2017, what will make it a little bit confusing how you should install VS2017 on a business VM with no internet connection. The Microsoft Visual Studio FAQ said:
Where can I find ISO Images?
We don’t have ISO files for Visual Studio 2017 because you have the ability to create your own offline layout installer.
Wow, this could be a problem… No, not really if you know how to deal with the new, better way of installing Visual Studio 2017. In this article I will guide you through the way of doing an offline or internal network installation from the beginning.
The reason for failure
Microsoft has decided that a package management for the Visual Studio 2017 with a corresponding downloader is a good thing because you can now decide in detail which packages you really need for the installation. In itself this is actually a good thing, as the setup is correspondingly smaller and easily centralizeable in a network share on a USB stick or what else. But in fact, this downloader is the problem because the first attempt is to access the URL (https://aka.ms/vs/15/release/installer), which is almost blocked in nearly every company by the proxy or a content filter, and then the downloader itself uses this URL to download the packages for the setup, which will also fail.
The next think are the CA root certificates for your virtual machine or workstation. When a signature is verified in an online environment, Windows APIs are used to download and add the certificates to the system. Verification that the certificate is trusted and allowed via administrative settings occurs during this process. This verification process cannot occur in most offline environments. Installing the certificates manually allows enterprise administrators to ensure the certificates are trusted and meet the security policy of their organization. This step you have to do manual. I will show you how to do this slightly further down. Now get things working.
Step by step guide for installing Visual Studio 2017
1. The modern way of installing VS2017 explained right
For an installation you need something similar to an ISO file, which is indeed only a ZIP file. Microsoft calls the local copy of the files/packages a “layout”. So you need a layout cache in a network share. To get this files you need a tool that can download and varify the files and ckeck for updates. This downloader is called a “bootstrapper” by Microsoft. In the layout cache folder you will find the installer exe and the packages you selected. You can install one package by its name (see below in step 4) or you can select one or more so called “workloads” which bunches many packages, e.g. select all components for desktop development at once.
Ok, let’s start the preparation for your creating your network layout cache.
2. Be sure you wouldn’t be blocked by a firewall or proxyserver
Behind a proxy or firewall be shure you can connect to the following Domains (try this for example in a browser of your choice).
You can check this one for example: https://aka.ms/vs/15/release/installer
If you get a block page then send the following list to your proxy administrator. He/She will get things working for you.
|download.visualstudio.microsoft.com||Storage for the packages|
|0download.microsoft.com||Storage for the packages|
|download.visualstudio.com||Storage for the packages|
|dl.xamarin.com||Storage for the packages|
|visualstudiogallery.msdn.microsoft.com||Storage for Visual Studio extensions|
|http://www.visualstudio.com||Storage for the documentation|
|msdn.microsoft.com||Storage for the documentation|
|http://www.microsoft.com||Storage for the documentation|
|Domain||Installation for Workloads|
|cocos2d-x.org||Game development with C++
|download.epicgames.com||Game development with C++
(Java SDK)Mobile development with .NET
|download.unity3d.com||Game development Unity
|netstorage.unity3d.com||Game development Unity
(Android SDK und NDK, Emulator)Mobile development with.NET
(Android SDK und NDK, Emulator)
|http://www.incredibuild.com||Game development with C++
|incredibuildvs2017i.azureedge.net||Game development with C++
|http://www.python.org||PythonData Science and analytics Apps
3. Get the installer and bootstrapper for your offline layout cache
Which edition of Visual Studio 2017 do you want to install? Get the right downlaoder (Microsoft calls this a bootstrapper) from Microsoft downlaodpage now. Here are the links:
|Visual Studio Enterprise||vs_enterprise.exe|
|Visual Studio Professional||vs_professional.exe|
|Visual Studio Community||vs_community.exe|
Keep in mind: if you need different editions of Visual Studio you have to create more than one layout cache! One for every edition.
4. Install the missing CA root certificates in your system
When a signature is verified in an online environment, Windows APIs are used to download and add the certificates to the system. Verification that the certificate is trusted and allowed via administrative settings occurs during this process. This verification process cannot occur in most offline environments. Installing the certificates manually allows enterprise administrators to ensure the certificates are trusted and meet the security policy of their organization. This step you have to do manual.
After downloading the downloader ( 😉 ) you can right click the vs_xxx.exe to do the following steps to install all two or three certificates by repeating this steps:
5. Let’s create a layout cache
- Create a folder on your machine like
- Create a network share and set permissions for all developers.
- Copy the downloader from step 3 in the directory you created in step 1
- Click on Windows start and enter “ISE” so you can start the Windows PowerShell ISE with administrator privilegs!!!
- Now I will explain you the commands for creating a Powershell script to define what to download for your installation. Please open the links in this block to read more details from Microsoft about a special topic:
--addto specify workload or component IDs. If
--addis used, only those workloads and components specified with
--addare downloaded. If
--addis not used, all workload and components are downloaded.
--includeRecommendedto include all the recommended components for the specified workload IDs
--includeOptionalto include all the recommended and optional components for the specified workload IDs.
--langto specify language locales.real power of the new way of installing VS 2017 is that there are several options you can use to customize your network layout Powershell script. You can create a partial layout that only contains a specific set of language locales, workloads, components, and their recommended or optional dependencies. This might be useful if you know that you are going to deploy only a subset of workloads to client workstations.
Here are a few examples of how to create a custom partial layout.
I recommend you to download all workloads and components for your language. Please be shure you have a lot of free space on your network drive (about 25-30 GB)
You can run the following command from the folder we created before with the downloader file in C:\VS2017 like:
vs_enterprise.exe --layout \\servername\vs2017 --lang en-US
- This will create some json files, download all the package files and get the setup.exe to your network share. You should see a console which shows something like this:
- Some other examples you can run to minimize the size of installation files are the following:To download all workloads and components for multiple languages, run:
vs_enterprise.exe --layout \\servername\vs2017 --lang en-US de-DE ja-JPTo download one workload for all languages, run
vs_enterprise.exe --layout \\servername\vs2017 --add Microsoft.VisualStudio.Workload.Azure --includeRecommended
- To download two workloads and one optional component for three languages, run:
vs_enterprise.exe --layout \\servername\vs2017 --add Microsoft.VisualStudio.Workload.Azure --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Component.GitHub.VisualStudio --includeRecommended --lang en-US de-DE ja-JPTo download two workloads and all of their recommended components, run:
vs_enterprise.exe --layout \\servername\vs2017 --add Microsoft.VisualStudio.Workload.Azure --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Component.GitHub.VisualStudio --includeRecommendedTo download two workloads and all of their recommended and optional components, run:
vs_enterprise.exe --layout \\servername\vs2017 --add Microsoft.VisualStudio.Workload.Azure --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Component.GitHub.VisualStudio --includeOptional
IMPORTANT: Sometimes you will get an error that sais something like:
Unable to download installation files. Check your internet connection and try again.
In this case try to open the following URL in a browser to be shure that no Firewall or contentfilter block your attempt (see step 2 for instructions when you see a blockpage):
6. Get ready for installing Visual Studio 2017 from your network
Now you can call the setup by console, Power Shell, System Center or what you want to call it on every computer, virtual machine and so on you want to install Visual Studio. Administrators can deploy Visual Studio onto client workstations as part of an installation script. Or, users who have administrator rights can run setup directly from the share to install Visual Studio on their machine.
- Users can install by running:
- Administrators can install in an unattended mode by running:
\\server\VS2017\vs_enterprise.exe --quiet --wait --norestart
- Users can install by running:
When executed as part of a batch file, the
--waitoption ensures that the
vs_enterprise.exeprocess waits until the installation is complete before it returns an exit code. This is useful if an enterprise administrator wants to perform further actions on a completed installation (for example, to apply a product key to a successful installation) but must wait for the installation to finish to handle the return code from that installation. If you do not use
vs_enterprise.exeprocess exits before the installation is complete and returns an inaccurate exit code that doesn’t represent the state of the install operation.
When you install from a layout, the content that is installed is acquired from the layout. However, if you select a component that is not in the layout, it will be acquired from the internet. If you want to prevent Visual Studio setup from downloading any content that is missing in your layout, use the
--noWebis used and the layout is missing any content that is selected to be installed, setup fails.
I hope this article will help all the DevOps guys out there to install their environment right. I had a lot of fun while writing and sharing this knowledge with you. Please feel free to contact me in the comments below if you have any further question.