Skip to content

Commit 8bf61b8

Browse files
author
mikeblome
committed
first pass for 16.1 updates complete
1 parent f97a5d6 commit 8bf61b8

23 files changed

Lines changed: 156 additions & 67 deletions

docs/linux/cmake-linux-project.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Configure a Linux CMake project in Visual Studio"
33
description: "How to configure, edit and compile a Linux CMake project in Visual Studio"
4-
ms.date: "05/21/2019"
4+
ms.date: "06/07/2019"
55
ms.assetid: f8707b32-f90d-494d-ae0b-1d44425fdc25
66
---
77

@@ -26,16 +26,16 @@ On the Linux machine, make sure that the following are installed:
2626

2727
::: moniker range="vs-2019"
2828

29-
Linux support for CMake projects requires a recent version of CMake to be installed on the target machine. Often, the version offered by a distribution’s default package manager is not recent enough to support all the IDE’s features. Visual Studio 2019 can automatically install a user local copy of CMake on remote Linux machines that don’t have a recent version of CMake installed. If a compatible version of CMake isn’t detected the first time you build your project, you will see an info-bar offering to install CMake.
30-
31-
The binaries will be installed to `~/.vs/cmake`. After deploying the binaries, your project will automatically regenerate. Note that if the CMake specified by the `cmakeExecutable` field in `CMakeSettings.json` is invalid (doesn't exist or is an unsupported version) and the prebuilt binaries are present Visual Studio will ignore `cmakeExecutable` and use the prebuilt binaries.
29+
Linux support for CMake projects requires a recent version of CMake to be installed on the target machine. Often, the version offered by a distribution’s default package manager is not recent enough to support all the features that are required by Visual Studio. Visual Studio 2019 detects whether a recent version of CMake is installed on the Linux system. If none is found, Visual Studio shows an info-bar at the top of the editor pane that offers to install it for you.
3230

3331
::: moniker-end
3432

3533
::: moniker range="vs-2017"
3634

3735
The CMake support in Visual Studio requires the server mode support that was introduced in CMake 3.8. For a Microsoft-provided CMake variant, download the latest prebuilt binaries at [https://github.com/Microsoft/CMake/releases](https://github.com/Microsoft/CMake/releases).
3836

37+
The binaries will be installed to `~/.vs/cmake`. After deploying the binaries, your project will automatically regenerate. Note that if the CMake specified by the `cmakeExecutable` field in `CMakeSettings.json` is invalid (doesn't exist or is an unsupported version) and the prebuilt binaries are present Visual Studio will ignore `cmakeExecutable` and use the prebuilt binaries.
38+
3939
:::moniker-end
4040

4141
## Open a folder
@@ -63,15 +63,21 @@ add_executable(hello-cmake hello.cpp)
6363

6464
## Choose a Linux target
6565

66-
As soon as you open the folder, Visual Studio parses the CMakeLists.txt file and specifies a Windows target of **x86-Debug**. To target Linux, change the project settings to **Linux-Debug** or **Linux-Release**.
66+
As soon as you open the folder, Visual Studio parses the CMakeLists.txt file and specifies a Windows target of **x86-Debug**. To target Linux, change the project settings to **Linux-Debug** or **Linux-Release**.
67+
68+
::: moniker range="vs-2019"
69+
70+
To target Windows Subsystem for Linux, choose **WSL-Debug**.
71+
72+
::: moniker-end
6773

6874
By default, Visual Studio chooses the first remote system in the list under **Tools** > **Options** > **Cross Platform** > **Connection Manager**. If no remote connections are found, you are prompted to create one. For more information, see [Connect to your remote Linux computer](connect-to-your-remote-linux-computer.md).
6975

7076
After you specify a Linux target, your source is copied to your Linux machine. Then, CMake is run on the Linux machine to generate the CMake cache for your project.
7177

7278
![Generate CMake cache on Linux](media/cmake-linux-1.png "Generate the CMake cache on Linux")
7379

74-
To provide IntelliSense support for remote headers, Visual Studio automatically copies them from the Linux machine to a directory on your local Windows machine. For more information, see [IntelliSense for remote headers](configure-a-linux-project.md#remote_intellisense).
80+
To provide IntelliSense support for remote headers, Visual Studio automatically copies them from the Linux machine (or WSL installation) to a directory on your local Windows machine. For more information, see [IntelliSense for remote headers](configure-a-linux-project.md#remote_intellisense).
7581

7682
## Debug the project
7783

@@ -87,7 +93,7 @@ A CMakeSettings.json file in a CMake Linux project can specify all the propertie
8793

8894
To change the default CMake settings in Visual Studio 2019, from the main toolbar, open the **Configuration** drop down and choose **Manage Configurations**.
8995

90-
![CMake Manage Configurations](../build/media/vs2019-cmake-manage-configurations.png "CMake configurations drop-down")
96+
![CMake Manage Configurations](../build/media/vs2019-cmake-manage-configurations.png "CMake configurations drop-down")
9197

9298
This brings up the **CMake Settings Editor** which you can use to edit the `CMakeSettings.json` file in your root project folder. You can also open the file directly by clicking the **Edit JSON** button in the editor. For more information, see [Customize CMake Settings](../build/customize-cmake-settings.md).
9399

docs/linux/configure-a-linux-project.md

Lines changed: 47 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,74 @@
11
---
22
title: "Configure a C++ Linux project in Visual Studio"
3-
ms.date: "11/12/2018"
3+
ms.date: "06/07/2019"
44
ms.assetid: 4d7c6adf-54b9-4b23-bd23-5de0c825b768
55
---
6-
# Configure a Linux Project
6+
# Configure a Linux project
77

8-
This topic describes how to configure a C++ Linux project that is based on a Linux project template in Visual Studio. For information about CMake Linux Projects in Visual Studio, see [Configure a Linux CMake Project ](cmake-linux-project.md).
8+
This topic describes how to configure a C++ Linux project as described in [Create a new C++ Linux project in Visual Studio](create-a-new-linux-project.md). For CMake Linux projects, see [Configure a Linux CMake Project ](cmake-linux-project.md).
9+
10+
You can configure a Linux project to target a physical Linux machine, a virtual machine, or the [Windows Subsystem for Linux](/windows/wsl/about).
11+
12+
::: moniker range="vs-2019"
13+
14+
**Visual Studio 2019 version 16.1** You can specify separate Linux targets for building and debugging.
15+
16+
::: moniker-end
917

1018
## General settings
1119

12-
A variety of options can be configured for a Linux project with Visual Studio. To view these options, select the **Project > Properties** menu, or right click on the project in **Solution Explorer** and select **Properties** from the context menu. The **General** settings appear.
20+
To view configuration options, select the **Project > Properties** menu, or right click on the project in **Solution Explorer** and select **Properties** from the context menu. The **General** settings appear.
1321

1422
![General configuration](media/settings_general.png)
1523

16-
By default, an executable (.out) is built with the tool. To build a static or dynamic library, or to use an existing Makefile, use the **Configuration Type** selection.
24+
By default, an executable (.out) is built with the tool. To build a static or dynamic library, or to use an existing Makefile, use the **Configuration Type** setting.
1725

18-
For more information about the options in the property pages, see [Linux Project Property Page Reference](prop-pages-linux.md).
26+
For more information about the settings in the property pages, see [Linux Project Property Page Reference](prop-pages-linux.md).
1927

2028
## Remote settings
2129

22-
To change settings pertaining to the remote Linux computer, configure the remote options that appear in the [General](prop-pages/general-linux.md) settings:
30+
To change settings pertaining to the remote Linux computer, configure the remote settings that appear under [General](prop-pages/general-linux.md).
2331

24-
- To change the target Linux computer, use the **Remote Build Machine** entry. This will allow you to select one of the connections created previously. To create a new entry, please see the [Connecting to Your Remote Linux Computer](connect-to-your-remote-linux-computer.md) section.
32+
- To specify a remote target Linux computer, use the **Remote Build Machine** entry. This will allow you to select one of the connections created previously. To create a new entry, see the [Connecting to Your Remote Linux Computer](connect-to-your-remote-linux-computer.md) section.
2533

26-
- The **Remote Build Root Directory** determines the root location of where the project is built on the remote Linux computer. This will default to **~/projects** unless changed.
34+
![Build Machine](media/remote-build-machine-vs2019.png)
2735

28-
- The **Remote Build Project Directory** is where this specific project will be built on the remote Linux computer. This will default to **$(RemoteRootDir)/$(ProjectName)**, which will expand to a directory named after the current project, under the root directory set above.
36+
::: moniker range="vs-2019"
2937

30-
> [!NOTE]
31-
> To change the default C and C++ compilers, or the Linker and Archiver used to build the project, use the appropriate entries in the **C/C++ > General** section and the **Linker > General** section. These could be set to use a certain version of GCC, or even the Clang compiler, for example. For more information see [C/C++ Properties (Linux C++)](prop-pages/c-cpp-linux.md) and [Linker Properties (Linux C++)](prop-pages/linker-linux.md).
32-
33-
## Include directories and IntelliSense support
38+
- **Visual Studio 16.1**: To target Windows Subsystem for Linux, click the down arrow for **Platform Toolset** and choose **WSL_1_0**. The other remote options will disappear and the path to the WSL shell will appear in their place:
3439

35-
**Visual Studio 2017 version 15.6 and earlier:**<br/>
36-
By default, Visual Studio does not include any system-level include files from the Linux computer. For example, items in the **/usr/include** directory are not present in Visual Studio.
37-
For full [IntelliSense](/visualstudio/ide/using-intellisense) support, you will need to copy those files to some location on your development computer and point Visual Studio to this location. One option is to use scp (Secure Copy) to copy the files. On Windows 10, you can use [Bash on Windows](https://msdn.microsoft.com/commandline/wsl/about) to run scp. For previous versions of Windows, you could use something like [PSCP (PuTTY Secure Copy)](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html).
40+
![WSL build machine](media/wsl-remote-vs2019.png)
3841

39-
You can copy the files by using a command similar to the following:
42+
You can specify a different target for debugging on the **Configuration Properties** > **Debugging** page.
4043

41-
`scp -r linux_username@remote_host:/usr/include .`
44+
::: moniker-end
4245

43-
Of course, replace the **linux_username** and **remote_host** values above for what's appropriate in your own environment.
46+
- The **Remote Build Root Directory** determines the root location of where the project is built on the remote Linux computer. This will default to **~/projects** unless changed.
4447

45-
Once the files are copied, use the **VC++ Directories** item in Project properties to tell Visual Studio where to find the additional include files that were just copied.
48+
- The **Remote Build Project Directory** is where this specific project will be built on the remote Linux computer. This will default to **$(RemoteRootDir)/$(ProjectName)**, which will expand to a directory named after the current project, under the root directory set above.
4649

47-
![VC++ Directories](media/settings_directories.png)
48-
49-
**Visual Studio 2017 version 15.7 and later:**<br/>
50-
See [Manage Remote Headers for IntelliSense](#remote_intellisense).
50+
> [!NOTE]
51+
> To change the default C and C++ compilers, or the Linker and Archiver used to build the project, use the appropriate entries in the **C/C++ > General** section and the **Linker > General** section. You can specify a certain version of GCC or Clang, for example. For more information see [C/C++ Properties (Linux C++)](prop-pages/c-cpp-linux.md) and [Linker Properties (Linux C++)](prop-pages/linker-linux.md).
5152
5253
## Copy sources
5354

54-
When building, the source files on your development PC are copied to the Linux computer and compiled there. By default, all sources in the Visual Studio project are copied to the locations set in the settings above. However, additional sources can also be added to the list, or copying sources can be turned off entirely, which is the default for a Makefile project.
55+
When building, the source files on your development PC are copied to the Linux computer and compiled there. By default, all sources in the Visual Studio project are copied to the locations set in the settings above. However, additional sources can also be added to the list, or copying sources can be turned off entirely, which is the default for a Makefile project.
5556

56-
- **Sources to copy** determines which sources are copied to the remote computer. By default, the **\@(SourcesToCopyRemotely)** defaults to all source code files in the project, but does not include any asset/resource files, such as images.
57+
- **Sources to copy** determines which sources are copied to the remote computer. By default, the **\@(SourcesToCopyRemotely)** defaults to all source code files in the project, but does not include any asset/resource files, such as images.
5758

5859
- **Copy sources** can be turned on and off to enable and disable the copying of source files to the remote computer.
5960

60-
- **Additional sources to copy** allows you to add additional source files which will be copied to the remote system. You can specify a semi-colon delimited list, or you can use the **:=** syntax to specify a local and remote name to use:
61+
- **Additional sources to copy** allows you to add additional source files which will be copied to the remote system. You can specify a semi-colon delimited list, or you can use the **:=** syntax to specify a local and remote name to use:
6162

6263
`C:\Projects\ConsoleApplication1\MyFile.cpp:=~/projects/ConsoleApplication1/ADifferentName.cpp;C:\Projects\ConsoleApplication1\MyFile2.cpp:=~/projects/ConsoleApplication1/ADifferentName2.cpp;`
6364

6465
## Build events
6566

66-
Since all compilation is happening on a remote computer, several additional Build Events have been added to the Build Events section in Project Properties. These are **Remote Pre-Build Event**, **Remote Pre-Link Event**, and **Remote Post-Build Event**, and will occur on the remote computer before or after the individual steps in the process.
67+
Since all compilation is happening on a remote computer (or WSL), several additional Build Events have been added to the Build Events section in Project Properties. These are **Remote Pre-Build Event**, **Remote Pre-Link Event**, and **Remote Post-Build Event**, and will occur on the remote computer before or after the individual steps in the process.
6768

6869
![Build Events](media/settings_buildevents.png)
6970

70-
## <a name="remote_intellisense"></a> IntelliSense for remote headers (Visual Studio 2017 version 15.7 and later)
71+
## <a name="remote_intellisense"></a> IntelliSense for remote headers
7172

7273
When you add a new connection in **Connection Manager**, Visual Studio automatically detects the include directories for the compiler on the remote system. Visual Studio then zips up and copies those files to a directory on your local Windows machine. After that, whenever you use that connection in a Visual Studio or CMake project, the headers in those directories are used to provide IntelliSense.
7374

@@ -77,10 +78,25 @@ This functionality depends on the Linux machine having zip installed. You can in
7778
apt install zip
7879
```
7980

80-
To manage your header cache, navigate to **Tools > Options, Cross Platform > Connection Manager > Remote Headers IntelliSense Manager**. To update the header cache after making changes on your Linux machine, select the remote connection and then select **Update**. Select **Delete** to remove the headers without deleting the connection itself. Select **Explore** to open the local directory in **File Explorer**. Treat this folder as read-only. To download headers for an existing connection that was created prior to version 15.3, select the connect and then select **Download**.
81+
To manage your header cache, navigate to **Tools > Options, Cross Platform > Connection Manager > Remote Headers IntelliSense Manager**. To update the header cache after making changes on your Linux machine, select the remote connection and then select **Update**. Select **Delete** to remove the headers without deleting the connection itself. Select **Explore** to open the local directory in **File Explorer**. Treat this folder as read-only. To download headers for an existing connection that was created prior to Visual Studio 2017 version 15.3, select the connection and then select **Download**.
82+
83+
::: moniker range="vs-2017"
8184

8285
![Remote Header IntelliSense](media/remote-header-intellisense.png)
8386

87+
::: moniker-end
88+
89+
::: moniker range="vs-2019"
90+
91+
![Remote Header IntelliSense](media/connection-manager-vs2019.png)
92+
93+
You can enable logging to help troubleshoot problems:
94+
95+
![Remote Logging](media/remote-logging-vs2019.png)
96+
97+
::: moniker-end
98+
99+
84100
## See also
85101

86102
[Set compiler and build properties](../build/working-with-project-properties.md)<br/>

docs/linux/connect-to-your-remote-linux-computer.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
---
22
title: "Connect to your remote Linux computer in Visual Studio"
33
description: "How to connect to a remote Linux machine from inside a Visual Studio C++ project."
4-
ms.date: "07/20/2018"
4+
ms.date: "06/07/2019"
55
ms.assetid: 5eeaa683-4e63-4c46-99ef-2d5f294040d4
66
---
77

88
# Connect to your remote Linux computer
99

10-
When building a C++ Linux project in Visual Studio, Linux code is copied to your remote Linux computer and then compiled based on Visual Studio settings. To set up this remote connection:
10+
::: moniker range="vs-2019"
11+
12+
When you target Windows Subsystem for Linux (WSL) Visual Studio interacts with your Linux distro directly through the file system; no remote connection is necessary.
13+
14+
::: moniker-end
15+
16+
When building a C++ Linux project for a remote Linux system (VM or physical machine), Linux code is copied to your remote Linux computer and then compiled based on Visual Studio settings. To set up this remote connection:
1117

1218
1. Build the project for the first time or manually create a new entry by selecting **Tools > Options** and then open the **Cross Platform > Connection Manager** node and click the **Add** button.
1319

0 commit comments

Comments
 (0)