Visual Studio Wsl



  1. Developing in WSL. The Visual Studio Code Remote - WSL extension lets you use the Windows Subsystem for Linux (WSL) as your full-time development environment right from VS Code. You can develop in a Linux-based environment, use Linux-specific toolchains and utilities, and run and debug your Linux-based applications all from the comfort of Windows. The extension runs commands and other extensions directly in WSL so you can edit files located in WSL.
  2. Are you a Windows developer interested in leveraging the power of Visual Studio to build and debug natively in WSL? Come learn about Visual Studio’s WSL supp.
  3. The Windows Subsystem for Linux (WSL) lets you run a Linux environment, including command-line tools and applications, directly on Windows, without the overhead.

Visual Studio Code has support for working directly in WSL with the Remote - WSL extension. We recommend this mode of WSL development, where all your source code files, in addition to the compiler, are hosted on the Linux distro. For more background, see VS Code Remote Development. Install Visual Studio (recommended) or the Microsoft C Build Tools On Windows, Rust requires certain C build tools. You can either download the Microsoft C Build Tools, or (recommended) you might prefer just to install Microsoft Visual Studio.

-->

Install Visual Studio Code Wsl

Important

As of April 12th 2021, connecting to GitHub Codespaces from Visual Studio 2019 will no longer be supported and this private preview has concluded. We’re focused on evolving experiences for a cloud-powered inner loop and VDI solutions optimized for a broad set of Visual Studio workloads. As part of this devinit and associated tools will no longer be available. We encourage you to be involved in our developer community forum for Visual Studio for information on future previews and roadmap information.

The wsl-install tool is used to install Linux distros for the Windows Subsystem for Linux (WSL).

Important

The wsl-install tool requires WSL 2 to already be enabled on Windows. If for some reason WSL 2 is not enabled, you can follow the WSL install documentation. You can also use the windowsfeature-enable tool for enabling any needed Windows Features.

Usage

If both the input and additionalOptions properties are omitted or empty, then the tool will follow the default behavior detailed below.

NameTypeRequiredValue
commentsstringNoOptional comments property. Not used.
inputstringYesThe distro to install. See Input below for details.
additionalOptionsstringNoSee Additional options below for details.

Input

The URI for the AppX application distribution package (.appx) containing the distro to deploy. The URI must point to a .appx archive that contains a single install.tar.gz either in archive root, or inside of an inner .appx archive. Examples of supported distros include:

DistroUri
Ubuntu 20.04https://aka.ms/wslubuntu2004
Ubuntu 18.04https://aka.ms/wsl-ubuntu-1804
Ubuntu 16.04https://aka.ms/wsl-ubuntu-1604
Debian GNU/Linuxhttps://aka.ms/wsl-debian-gnulinux
Kali Linuxhttps://aka.ms/wsl-kali-linux-new
OpenSUSE Leap 42https://aka.ms/wsl-opensuse-42
SUSE Linux Enterprise Server 12https://aka.ms/wsl-sles-12

Note

Visual

ARM Linux distros are not currently supported in GitHub Codespaces.

Additional options

Multiple additional options are supported:

NameTypeRequiredValue
--wsl-versionstringNoWSL version to use. The default value is 2.
--post-create-commandstringNoThe command to execute inside of the Linux distro once the installation is complete. The command should be formatted as a single word, or wrapped in quotes. The default is no command.

Default behavior

Visual Studio Code Wsl

Clang tidy example. The default behavior of the wsl-install tool is to error as the input property, the distro to install, is required.

Example usage

Below are examples of how to run wsl-install using a .devinit.json.

.devinit.json that will install Ubuntu 20.04:

Visual studio wsl

.devinit.json that will install Ubuntu 20.04 and perform a post create command:

.devinit.json that will install Ubuntu 20.04 and perform a post create command that configures the packages listed: