Have you ever wanted to try using Windows Subsystem for Linux (WSL) to target Linux from your C++ project, but haven’t gone through the documentation or CLI installation process? Now, from Visual Studio with the Linux and Embedded Workload, Visual Studio makes it easier than ever to get to that one-click install of WSL. Download the latest preview version of Visual Studio and select the Linux and Embedded workload to give it a try!
How do I start?
When you open a CMake project that can target Linux, an info bar will open for users to click and open a WSL installation process. By default, it will install a WSL2 Linux VM with the Ubuntu distribution.Â
Additionally, you can open the dialog by navigation at any time to Project > Install WSL for me.
If you don’t have a WSL machine already installed on your machine, an additional option will be available in your Target Machine dropdown to “Create Linux Environment.”
What happens next?
Once you click one of these options, an installation dialog will pop up. In the installation dialog, it will automatically check the status of pre-requisites on your machine for the installation and populate additional information if anything needs pre-configuring. You can hover over the question mark icon to learn more information about each pre-requisite check. If any pre-requisite fails, you can follow the error information to fix the errors, and then select “Refresh System Check Values” to re-run the pre-requisite checks.
After the pre-requisites are run and all pass, the installation process will kick off.
At the end, you can select “Finish” and the new WSL machine with build tools downloaded will be selected as the target machine for your existing CMake project.
Coming Soon
We will be planning on adding additional tutorial content to open the installer, additional information messaging and customization, and the installer will automatically re-open after reboot of machine. Let us know if there’s anything else you’d like to see!
What do you think?
We hope this new WSL acquisition experience will help you install and re-target your applications to WSL. Download the latest preview version of Visual Studio and give it a try.
Please let us know your thoughts and if you hit any issues! We are actively developing this feature set and would love to hear what would improve your workflow even more. This feature is still fairly new, so please let us know in the comments below or on Visual Studio Feedback if you hit any issues as well. You can also find us on Twitter (@VisualC) or via email at visualcpp@microsoft.com.
Does it install the base packages that you’ll need too, such as “g++ gdb make ninja-build rsync zip pkg-config nasm cmake” and VCPkg?
Thanks
Ben
Hi Ben! It comes with all except vcpkg, nasm, and pkg-config.