Guide to Creating Offline Installation Package for VS 2022 Preview

Guide to Creating Offline Installation Package for VS 2022 Preview

Setting up an offline development environment is the most troublesome. This article details how to create an offline installation package for VS 2022 Preview, including complete download, installation steps and precautions

Last updated 2/27/2025 9:18 AM
沙漠尽头的狼
4 min read
Category
.NET
Tags
.NET C# Visual Studio Development Environment Offline Installation

Preparation

  1. Download the Visual Studio 2022 Preview bootstrapper

  2. Prepare storage space

    • It is recommended to reserve at least 200 GB of hard disk space
    • Choose an environment with good network access

Creating an Offline Installation Package

1. Download via Command Line

Open a command prompt (as Administrator) and run the following command:

VisualStudioSetup.exe --layout D:\2022 --noweb --add Microsoft.VisualStudio.Workload.NetWeb Microsoft.VisualStudio.Workload.NetDesktop --includeRecommended --lang Zh-cn en-US

Parameter description:

  • --add: Used to specify workload or component IDs. If --add is used, only the workloads and components specified by --add will be downloaded. If --add is not used, all workloads and components will be downloaded.
  • --includeRecommended: Adds all recommended components for the specified workload IDs.
  • --includeOptional: Adds all optional components for the specified workload IDs.
  • --config: Uses a *.vsconfig file to specify workloads, components, or extensions that should be included in or referenced by the layout. Ensure to specify the full path to the configuration file.
  • --lang: Used to specify language locales.

Common workload IDs

  • .NET desktop development: Microsoft.VisualStudio.Workload.NetDesktop
  • ASP.NET and web development: Microsoft.VisualStudio.Workload.NetWeb
  • .NET cross-platform development: Microsoft.VisualStudio.Workload.NetCrossPlat
  • Azure development: Microsoft.VisualStudio.Workload.Azure
  • Data storage and processing: Microsoft.VisualStudio.Workload.Data

The above are parameter examples based on official documentation, but we can actually use a simpler command:

VisualStudioSetup.exe --layout D:\2022

Advantages of this simplified command:

  1. Downloads all available components, ensuring no required functionality is missed
  2. Includes all language packs, suitable for multilingual development teams
  3. Avoids component omissions caused by incorrect parameter configuration

Although this method uses more storage space (about 80 GB, ~66 GB compressed), it is the most hassle-free approach if network conditions permit.

Note: To create a layout of the entire product and use the latest and best installer, run

VisualStudioSetup.exe --layout D:\2022 --useLatestInstaller

During the process, some packages may fail to download:

In the example above, Unity3d failed to download due to a signature issue. However, since I do not do related development, this can be ignored. The resulting installation package can still be installed normally. If the corresponding package is needed, further investigation may be required.

2. Offline Installation

On the target machine, simply double-click the VisualStudioSetup.exe in the directory to install.

Important Notes

  1. Ensure network stability during the download
  2. After downloading, compress and transfer to the target machine, e.g., via FTP
  3. To update the layout, run the same command to perform an incremental update
  4. It is recommended to regularly update the offline package to obtain the latest security patches

Common Problem Solving

  1. Download interruption

    • Re-run the same command; it will resume the incomplete download
  2. Installation failure

    • Check that certificates are properly installed
    • Confirm the target machine meets system requirements
    • Review log files to pinpoint the specific cause
  3. Missing components

    • Verify that workloads are correctly specified
    • Confirm the use of --includeRecommended and --includeOptional parameters

Summary

Through the steps above, we can create a complete offline installation package for Visual Studio 2022 Preview. This is especially useful in network-restricted environments, ensuring that the development team uses a consistent development environment. Remember to regularly update the offline package to get the latest features and security updates.

References:

Keep Exploring

Related Reading

More Articles