Visual Studio has evolved quite significantly since its introduction ten years ago, from IDE features to the integration of various DevOps scenarios. With Visual Studio 2017, even the installation experience has changed; developers can now select the components that they wish to download and install, as well as install various releases of Visual Studio side-by-side. Let’s see how we can make an offline installer for Visual Studio 2017, along with Xamarin, with a view to use the offline installer multiple times on other machines. This blog post covers all editions of Visual Studio 2017 including Community, Professional, Enterprise, and Preview releases.

Grab the Installer

Visit the Visual Studio website and download the installer. You can also download the preview installer here.

Once you’ve downloaded the executable, rename it to something readable so it will be easier to use in the command line interface later. For this example, we’ll name ours vs_enterprise.exe.

Download Contents for Offline Install

Visual Studio allows you to build apps for many platforms, using many technologies, making the download size is significant. Luckily, you can download just the required components for mobile development if you only develop for mobile platforms. If you wish to download everything Visual Studio has to offer, run the following command on your command prompt:

C:\>vs_enterprise.exe --layout C:\VS2017 --lang en-US

This will download all of the installation components, with the language set to English (United States), inside the C:\VS2017 folder. Remember, this can be huge in size (usually in excess of 20GB).

There is also an option to download only the components that are required for cross-platform mobile development. These are packaged into workloads. For example:

C:\>vs_enterprise.exe --layout C:\VS2017 --lang en-US --add Microsoft.VisualStudio.Workload.NetCrossPlat

…will download Xamarin and related components, whereas…

C:\>vs_enterprise.exe --layout C:\VS2017 --lang en-US --add Microsoft.VisualStudio.Workload.Universal

…will download components required for building Universal Windows Platform applications. The entire list of workloads is available here.

Almost every mobile app needs to connect to at least one service, such as ASP.NET MVC WebAPI hosted inside Azure. Additional components are required to build and use such services. The following command installs all required components:

C:\>vs_enterprise.exe --layout C:\VS2017 --lang en-US --add Microsoft.VisualStudio.Workload.Azure Microsoft.VisualStudio.Workload.ManagedDesktop Microsoft.VisualStudio.Workload.NetCoreTools Microsoft.VisualStudio.Workload.NetCrossPlat Component.Android.NDK.R13B Component.Android.SDK23 Component.Xamarin Component.Xamarin.Inspector Component.Xamarin.Profiler Component.Xamarin.RemotedSimulator Microsoft.VisualStudio.Workload.NetWeb Microsoft.VisualStudio.Workload.Universal

Once all of the components are downloaded, look for the certificate folder. Install all of the certificates before you run the installer.

Now you can run the offline installer from your folder. It will launch and install all of the components you selected.

Verify Installation

Once the installation is complete, start Visual Studio and check for any updates available for Visual Studio, along with Android SDKs (from Tools > Android > Android SDK Manager), etc.

Create a new cross-platform app project once all of the updates are installed, Xamarin.Forms for example, and run it on your device or emulator. If you get the app running with a ‘Welcome to Xamarin.Forms’ message, then you have installed Visual Studio with all of the required tools for cross-platform mobile development.

Wrapping Up

If you have a development team of more than a handful of developers, or your internet connection has limited bandwidth (or the computers are simply not connected to the internet), then taking the time to create an offline installer for Visual Studio 2017 is definitely a worthy consideration, saving time and valuable resources. You can find more information about Offline Installation an related issues here.