# Visual Studio 2022 Offline Installation

Here are steps to install Visual Studio 2022 in an offline environment.

It involved creating a layout fileset, which is what the installer runs from.  
This is created by a bootstrap executable, below.

### Layout Download

From a machine with internet access, download the installer bootstrapper from here:

[https://learn.microsoft.com/en-us/visualstudio/install/create-a-network-installation-of-visual-studio?view=vs-2022#download-the-visual-studio-bootstrapper-to-create-the-layout](https://learn.microsoft.com/en-us/visualstudio/install/create-a-network-installation-of-visual-studio?view=vs-2022#download-the-visual-studio-bootstrapper-to-create-the-layout)

Place the bootstrapper in a folder, where your layout will be.

Open an elevated terminal, and run this, to download the initial offline set:

```bash
"vs_professional.exe" --LayOut "C:\Programs\VisualStudio2022\VS2022_OfflineInstall\layout" --lang en-US
```

<p class="callout info">NOTE: This downloads all packages for that version.</p>

Once that is downloaded, you will need to add packages for legacy NET Framework support.  
Use this:

```bash
"vs_professional.exe" --LayOut "C:\Programs\VisualStudio2022\VS2022_OfflineInstall\layout" ^
  --add Microsoft.Net.Component.4.6.2.TargetingPack ^
  --add Microsoft.Net.Component.4.7.2.TargetingPack ^
  --add Microsoft.Net.Component.4.8.TargetingPack ^
  --add Microsoft.Net.Component.4.8.SDK ^
  --add Microsoft.Net.Component.4.8.1.TargetingPack ^
  --add Microsoft.Net.Component.4.8.1.SDK ^
  --lang en-US
```

This will attempt to add packages for NET Framework 4.5.2:

```bash
"vs_professional.exe" --LayOut "C:\Programs\VisualStudio2022\VS2022_OfflineInstall\layout" ^
  --add Microsoft.Net.Component.4.5.2.TargetingPack ^
  --lang en-US
```

<span style="color: rgb(187, 187, 187); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Oxygen, Ubuntu, Roboto, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; font-size: 2.333em; font-weight: 400;">Copy to Target</span>

Copy the downloaded bootstrapper and layout fileset to the target machine.

### Install Certificates

On the offline machine, navigate to the certificates folder: Certificates → install  
Install the .cer files from the layout\\Certificates folder into Trusted Root and Trusted Publishers on the offline machine.

### Install WebView2 Runtime

The installer UI requires WebView2 Runtime.  
Download the Evergreen Standalone installer for x64 on a connected machine.  
Copy it to the offline machine, and run it once on the offline box before launching VS setup.

### Run Installer

Run the bootstrapper command, to start the offline installer UI:

```bash
"vs_professional.exe" --noWeb
```