Using remote SSH in vscode plug-in



  • Every time you change a computer, you have to build a new development environment…
  • Whenever the latest code program can not run in the local, it is necessary to check the server and development computer environment…
  • Whenever the server has a bug, I think if I can debug the server code..
  • Have you been fed up with VIM editor…
  • Now the most popular is cloud native application. When can we develop cloud?

It’s coming, it’s coming!!!

On May 3, 2019, Beijing time, Microsoft released vs code remote at the pycon 2019 conference, opening a new era of remote development! This release includes three core new plug-ins that help developers achieve seamless remote development in containers, physical or virtual machines, and windows subsystem for Linux (WSL). By installing the remote development extension pack, you can start remote development quickly.

Visual studio code remote allows developers to use containers, remote computers, or windows subsystem for Linux (WSL) as a complete development environment. You can:

  • Develop on the same operating system deployed, or use larger or more specialized hardware.
  • Use the development environment as a sandbox to avoid affecting the local computer configuration.
  • Let the novice start easily, let everyone keep consistent development environment.
  • Use tools or runtimes that are not available in your local environment, or manage multiple versions of them.
  • Developing Linux Application in WSL.
  • Access the existing development environment from multiple different computers.
  • Debug applications that run in other locations, such as the customer’s website or the cloud.

Let’s let the blogger take you to know about this plug-in.

This blog introduces remote SSH from the following aspects

  • Remote series plug-ins are divided into three types. Small partners can install them on demand. The blogger selects one of the most commonly used remote SSH to explain it. In short, this plug-in is remote terminal + code highlight prompt + remote debugging and development + visual Linux file directory.
  • How to install plug-ins
  • How to connect Linux with terminal
  • How to use visual Linux file directory workspace
  • How to use vscode to view files instead of vim editor
  • How to develop dotnet program, compile, run and debug on Linux server

Installing plug-ins

If the computer does not have SSH, you need to install OpenSSL or GIT. The latest version of win10 comes with you.
Open the vscode plug-in store and install the following plug-ins

Next, you need to configure the SSH configuration information for connecting to the server

And then it’s done. Open a new window and enter the password several times. Next time you want to enter, you can click the small computer button on the left

How to connect Linux without password

We have already connected to our own Linux host, but it’s too annoying to input the password each time. Now I put the SSH public key on the server, and I can use the SSH keygen command to generate a pair of

Then copy the public key to this directory on the server

Then use vscode to open the configuration file to check whether the following two lines are commented

Execute cat ID_ >> authorized_ keys

Then restart the sshd service of Linux, and then use vscode to connect to Linux without password!

How to use visual Linux file directory workspace

As shown in the figure below

This has become the familiar windows.. And the right-click shortcut menu.. I love this plugin so much (it’s so damn powerful)..

How to develop dotnet program, compile, run and debug on Linux server

Because you want to develop and compile on the server, you need to install the dotnet SDK, and you can install it by yourself

Vscode needs to install and load the C ා plug-in and this remote flag appears

Let’s create a dotnet console project and execute the following command

dotnet new console -n "dotnet-onLinuxDevelop"

Then open it with vscode Program.cs

Then we modify the code and run it directly on the server

Finally, we need to debug and configure the DLL directory on the server to launch.json As shown in the figure below

Then configure it task.json So we don’t have to manually compile each time

Debugging success!!!

This article introduces the implementation of remote SSH in vscode plug-in. For more relevant vscode remote SSH content, please search the previous articles of developeppaer or continue to browse the related articles below. I hope you can support developeppaer more in the future!