C++ Linux development with Visual Studio: incremental build improvements and expanded shell support

Erika Sweet

Visual Studio 2019 allows C++ developers to target both Windows and Linux (including the Windows Subsystem for Linux) from the comfort of a single IDE. Visual Studio 2019 version 16.7 Preview 3 introduces two features specific to Linux development: improved build incrementality for MSBuild-based Linux projects, and support for a wider range of Linux distributions and shells.

There are two ways C++ developers can target Linux systems from Visual Studio. Our recommendation for anything cross-platform or with an eye to open-sourcing is our native support for CMake. This allows you to leverage the same source code and build scripts to target multiple platforms. Alternatively, you can create a MSBuild-based Linux project for a familiar Visual Studio experience.

Improved build incrementality for MSBuild-based Linux projects

You can now leverage Ninja for faster incremental builds in MSBuild-based Linux projects. To enable building with Ninja, navigate to Property Pages > General and set “Enable Incremental Build” to “With Ninja”.

Image of Property Pages with the new property "Enable Incremental Build" highlighted and set to "With Ninja"

Make sure you have ninja installed on your Linux system. You can install ninja on Debian-based Linux systems with the following commands:

sudo apt-get update

sudo apt-get install ninja-build

We tested Ninja’s build performance with a MSBuild-based Linux project that contained 1000 .h files and 1000 .cpp files. Ninja led to faster build times for both a full rebuild and a build where one header file was changed.

End to end build time for full rebuild (in min) End to end build time with one change (in min)
Enable Incremental Build == With Ninja 8:01 0:32
Enable Incremental Build == No 12:57 5:26


These tests were run against a local VM (Ubuntu 20.04) connected to Visual Studio over SSH, but you can leverage these improvements with both our SSH support and native support for WSL. As a reminder, in MSBuild-based Linux projects you can select your platform toolset (WSL or remote) via Property Pages > General > Platform Toolset.

Support for a wider range of Linux distributions and shells

We also added support for a wider range of Linux distributions and shells. These changes apply to both CMake projects and MSBuild-based Linux projects targeting a remote Linux system or WSL. Visual Studio now queries for the shell the first time a command is issued. It then decides how to format a command line when redirecting stderr and how to detach from a running command based on the shell that is discovered. Visual Studio now supports the following shells: sh, csh, bash, tcsh, ksh, zsh, and dash. If the shell found on the Linux system is not supported, then we fall back to explicitly use “sh” for all commands.

We also added new options and commands to ConnectionManager.exe to help you override the choice of shell for a connection. ConnectionManager.exe is a command-line utility to manage stored remote connections outside of Visual Studio.

  • ConnectionManager.exe list – -properties
    • When present, the list of properties defined for the connection will be printed out for each connection.
  • ConnectionManager.exe modify [default | connection_id | user@host [- -port port]] – -property [key=value]
    • Define or modify a property on a connection. If “value” is empty, then the property “key” is deleted. For example, use ConnectionManager.exe modify 21212121 – -property shell=csh to override the choice of shell for the connection with connection ID 21212121.
    • You can run the command ConnectionManager.exe list to view a list of stored connections by connection ID.

Finally, we’ve tested our support against a wider range of Linux distros through changes to the commands issued.  Key functionality like project creation, the remote header sync, build, and debug have been tested for both CMake projects and MSBuild-based Linux projects with the following distros + shells.

Unix distro Validated shells
FreeBSD csh, fish, zsh, bash
Ubuntu (WSL) bash
Ubuntu 18.04 fish, bash, csh, zsh
Debian (WSL) dash


Give us your feedback

Download Visual Studio 2019 version 16.7 Preview 3 today and give it a try. We’d love to hear from you to help us prioritize and build the right features for you. We can be reached via the comments below, Developer Community, and Twitter (@VisualC). The best way to file a bug or suggest a feature is via Developer Community.