Skip to content

Commit b1f99b1

Browse files
author
Colin Robertson
committed
Acrolinx more things.
1 parent d7a514d commit b1f99b1

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Connect to your target Linux system in Visual Studio"
3-
description: "How to connect to a remote Linux machine or WSL from inside a Visual Studio C++ project."
4-
ms.date: "09/04/2019"
3+
description: "How to connect to a remote Linux machine or Windows Subsystem for Linux from inside a Visual Studio C++ project."
4+
ms.date: "11/09/2019"
55
ms.assetid: 5eeaa683-4e63-4c46-99ef-2d5f294040d4
66
---
77
# Connect to your target Linux system in Visual Studio
@@ -18,15 +18,15 @@ You can configure a Linux project to target a remote machine or the Windows Subs
1818

1919
## Connect to a remote Linux computer
2020

21-
When building a C++ Linux project for a remote Linux system (VM or physical machine), Linux source code is copied to your remote Linux computer and then compiled based on Visual Studio settings.
21+
When building a C++ Linux project for a remote Linux system (VM or physical machine), Linux source code is copied to your remote Linux computer. Then, it's compiled based on Visual Studio settings.
2222

2323
To set up this remote connection:
2424

25-
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.
25+
1. Build the project for the first time. Or, you can create a new entry manually. Select **Tools > Options**, open the **Cross Platform > Connection Manager** node, and then choose the **Add** button.
2626

2727
![Connection Manager](media/settings_connectionmanager.png)
2828

29-
In either scenario, the **Connect to Remote System** window will be displayed.
29+
In either scenario, the **Connect to Remote System** window is displayed.
3030

3131
![Connect to Remote System](media/connect.png)
3232

@@ -37,30 +37,30 @@ To set up this remote connection:
3737
| **Host Name** | Name or IP address of your target device
3838
| **Port** | Port that the SSH service is running on, typically 22
3939
| **User name** | User to authenticate as
40-
| **Authentication type** | Password or Private Key are both supported
40+
| **Authentication type** | Password and Private Key are both supported
4141
| **Password** | Password for the entered user name
4242
| **Private key file** | Private key file created for ssh connection
4343
| **Passphrase** | Passphrase used with private key selected above
4444

45-
You can use either a password or key file and passphrase for authentication. For many development scenarios, password authentication is sufficient. If you prefer to use a public/private key file, you can create a new one or [reuse an existing one](https://security.stackexchange.com/questions/10203/reusing-private-public-keys). Currently only RSA and DSA keys are supported.
45+
You can use either a password or a key file and passphrase for authentication. For many development scenarios, password authentication is sufficient. If you prefer to use a public/private key file, you can create a new one or [reuse an existing one](https://security.stackexchange.com/questions/10203/reusing-private-public-keys). Currently only RSA and DSA keys are supported.
4646

4747
You can create a private RSA key file by following these steps:
4848

49-
1. On the Windows machine, create the ssh key pair with `ssh-keygen -t rsa`. This will create a public key and a private key. By default the keys are placed under `C:\Users\%USERNAME%\.ssh` with names `id_rsa.pub` and `id_rsa`.
49+
1. On the Windows machine, create the ssh key pair with `ssh-keygen -t rsa`. The command creates a public key and a private key. By default, it places the keys under `C:\Users\%USERNAME%\.ssh`, using the names `id_rsa.pub` and `id_rsa`.
5050

5151
1. From Windows, copy the public key to the Linux machine: `scp -p C:\Users\%USERNAME%\.ssh\id_rsa.pub user@hostname`.
5252

5353
1. On the Linux system, add the key to the list of authorized keys (and ensure the file has the correct permissions): `cat ~/id_rsa.pub >> ~/.ssh/authorized_keys; chmod 600 ~/.ssh/authorized_keys`
5454

55-
1. Click the **Connect** button to attempt a connection to the remote computer.
55+
1. Choose the **Connect** button to attempt a connection to the remote computer.
5656

5757
If the connection succeeds, Visual Studio will begin configuring IntelliSense to use the remote headers. For more information, see [IntelliSense for headers on remote systems](configure-a-linux-project.md#remote_intellisense).
5858

5959
If the connection fails, the entry boxes that need to be changed are outlined in red.
6060

6161
![Connection Manager Error](media/settings_connectionmanagererror.png)
6262

63-
If you are using key files for authentication, ensure the target machine's SSH server is running and configured properly.
63+
If you use key files for authentication, make sure the target machine's SSH server is running and configured properly.
6464

6565
::: moniker-end
6666

@@ -72,51 +72,51 @@ To set up this remote connection:
7272

7373
Logs include connections, all commands sent to the remote machine (their text, exit code and execution time), and all output from Visual Studio to the shell. Logging works for any cross-platform CMake project or MSBuild-based Linux project in Visual Studio.
7474

75-
You can configure the output to go to a file or to the **Cross Platform Logging** pane in the Output Window. For MSBuild-based Linux projects, commands issued to the remote machine by MSBuild are not routed to the **Output Window** because they are emitted out-of-process. Instead, they are logged to a file with the "msbuild_" prefix.
75+
You can configure the output to go to a file or to the **Cross Platform Logging** pane in the Output Window. For MSBuild-based Linux projects, MSBuild commands sent to the remote machine aren't routed to the **Output Window** because they're emitted out-of-process. Instead, they're logged to a file, with a prefix of "msbuild_".
7676

7777
## TCP Port Forwarding
7878

7979
Visual Studio's Linux support has a dependency on TCP port forwarding. **Rsync** and **gdbserver** will be affected if TCP port forwarding is disabled on your remote system.
8080

81-
Rsync is used by both MSBuild-based Linux projects and CMake projects to [copy headers from your remote system to Windows to be used for IntelliSense](configure-a-linux-project.md#remote_intellisense). If you're not able to enable TCP port forwarding then you can disable the automatic download of remote headers via Tools > Options > Cross Platform > Connection Manager > Remote Headers IntelliSense Manager. If the remote system you are trying to connect to does not have TCP port forwarding enabled, then you will see the following error when the download of remote headers for IntelliSense begins.
81+
rsync is used by both MSBuild-based Linux projects and CMake projects to [copy headers from your remote system to Windows for use by IntelliSense](configure-a-linux-project.md#remote_intellisense). When you can't enable TCP port forwarding, disable the automatic download of remote headers. To disable it, use **Tools > Options > Cross Platform > Connection Manager > Remote Headers IntelliSense Manager**. If the remote system doesn't have TCP port forwarding enabled, you'll see this error when the download of remote headers for IntelliSense begins:
8282

8383
![Headers Error](media/port-forwarding-headers-error.png)
8484

85-
Rsync is also used by Visual Studio's CMake support to copy source files to the remote system. If you're not able to enable TCP port forwarding then you can use sftp as your remote copy sources method . Sftp is generally slower than rsync but does not have a dependency on TCP port forwarding. You can manage your remote copy sources method with the remoteCopySourcesMethod property in the [CMake Settings Editor](../build/cmakesettings-reference.md#additional-settings-for-cmake-linux-projects). If TCP port forwarding is disabled on your remote system then you will see an error in the CMake output window the first time rsync is invoked.
85+
rsync is also used by Visual Studio's CMake support to copy source files to the remote system. If you can't enable TCP port forwarding, you can use sftp as your remote copy sources method. sftp is often slower than rsync, but doesn't have a dependency on TCP port forwarding. You can manage your remote copy sources method with the **remoteCopySourcesMethod** property in the [CMake Settings Editor](../build/cmakesettings-reference.md#additional-settings-for-cmake-linux-projects). If TCP port forwarding is disabled on your remote system, you'll see an error in the CMake output window the first time it invokes rsync.
8686

8787
![Rsync Error](media/port-forwarding-copy-error.png)
8888

89-
Gdbserver can be used for debugging on embedded devices. If you're not able to enable TCP port forwarding then you will need to use the gdb for all remote debugging scenarios. Gdb is used by default when debugging projects on a remote system.
89+
gdbserver can be used for debugging on embedded devices. If you can't enable TCP port forwarding, then you must use gdb for all remote debugging scenarios. gdb is used by default when debugging projects on a remote system.
9090

9191
::: moniker-end
9292

9393
## Connect to WSL
9494

9595
::: moniker range="vs-2017"
9696

97-
In Visual Studio 2017, you connect to WSL by using the same steps as connecting to a remote Linux machine as described earlier in this article. Use **localhost** for the **Host Name**.
97+
In Visual Studio 2017, you use the same steps to connect to WSL as you use for a remote Linux machine. Use **localhost** for the **Host Name**.
9898

9999
::: moniker-end
100100

101101
::: moniker range="vs-2019"
102102

103-
Visual Studio 2019 version 16.1 added native support for using C++ with the [Windows Subsystem for Linux (WSL)](/windows/wsl/about). This means that you no longer need to add a remote connection or configure SSH in order to build and debug on your local WSL installation. You can find details on [how to install WSL](/windows/wsl/install-win10) here.
103+
Visual Studio 2019 version 16.1 added native support for using C++ with the [Windows Subsystem for Linux (WSL)](/windows/wsl/about). That means you can build and debug on your local WSL installation directly. You no longer need to add a remote connection or configure SSH. You can find details on [how to install WSL](/windows/wsl/install-win10) here.
104104

105-
To configure your WSL installation to work with Visual Studio you need the following tools installed: gcc or clang, gdb, make, rsync, and zip. You can install them on distros that use apt by using this command, which also installs the g++ compiler:
105+
To configure your WSL installation to work with Visual Studio, you need the following tools installed: gcc or clang, gdb, make, rsync, and zip. You can install them on distros that use apt by using this command, which also installs the g++ compiler:
106106

107107
```bash
108108
sudo apt install g++ gdb make rsync zip
109109
```
110110

111111
For more information, see [Download, install, and set up the Linux workload](download-install-and-setup-the-linux-development-workload.md).
112112

113-
To configure your project for WSL, see [Configure a Linux project](configure-a-linux-project.md) or [Configure a Linux CMake project](cmake-linux-project.md) depending on which kind of project you have. To follow step-by-step instructions for creating a simple console application with WSL, check out this introductory blog post on [C++ with Visual Studio 2019 and the Windows Subsystem for Linux (WSL)](https://devblogs.microsoft.com/cppblog/c-with-visual-studio-2019-and-windows-subsystem-for-linux-wsl/).
113+
To configure an MSBuild project for WSL, see [Configure a Linux project](configure-a-linux-project.md). To configure a CMake project for WSL, see [Configure a Linux CMake project](cmake-linux-project.md). To follow step-by-step instructions for creating a simple console application with WSL, check out this introductory blog post on [C++ with Visual Studio 2019 and the Windows Subsystem for Linux (WSL)](https://devblogs.microsoft.com/cppblog/c-with-visual-studio-2019-and-windows-subsystem-for-linux-wsl/).
114114

115115
::: moniker-end
116116

117117
## See Also
118118

119119
[Configure a Linux project](configure-a-linux-project.md)\
120120
[Configure a Linux CMake project](cmake-linux-project.md)\
121-
[Deploy, run and debug your Linux project](deploy-run-and-debug-your-linux-project.md)\
121+
[Deploy, run, and debug your Linux project](deploy-run-and-debug-your-linux-project.md)\
122122
[Configure CMake debugging sessions](../build/configure-cmake-debugging-sessions.md)

0 commit comments

Comments
 (0)