VS2017. NET core Debugging steps on Linux

Source: Internet
Author: User
Tags dotnet ssh server
This article mainly describes the VS2017 Linux on the. NET core debugging, small series feel very good, and now share to everyone, but also for everyone to make a reference. Let's take a look at it with a little knitting.

Visual Studio 2017 uses SSH to debug a. NET Core application on Linux.

This article environment

Development environment: WIN10 x64 Visual Studio 2017

Deployment environment: Ubuntu 14.04 x64. NET Core SDK 1.0.1

Install the. NET Core SDK on Ubuntu

Ubuntu 14.04 x64

sudo sh-c ' echo ' Deb [ARCH=AMD64] https://apt-mo.trafficmanager.net/repos/dotnet-release/trusty main ">/etc/apt/ Sources.list.d/dotnetdev.list ' sudo apt-key adv--keyserver hkp://keyserver.ubuntu.com:80--recv-keys 417A0893sudo Apt-get Update

If you have previously installed the preview version, be sure to update it.

Then install the latest version of the SDK 1.0.1

sudo apt-get install dotnet-dev-1.0.1

After the installation is complete, execute dotnet--info as follows:

Indicates that the SDK installation was successful.

Then on the Linux server, you need to install the SSH server, unzip and curl or wget. The command is as follows:

sudo apt-get install openssh-server unzip Curl

When the installation is complete, everything is ready.

New program

Open vs 2017 Create a new console app. NET Core is named: Linuxdemo.

Add the following code to Program.cs:

  Class program  {    static void Main (string[] args)    {      Console.WriteLine ("Hello world! Linezero ");      Console.WriteLine ("Linux. NET Core Debug");      Console.WriteLine ("' Q ' Exit");      while (true)      {        var result = Console.ReadLine ();        if (result. Equals ("Q"))          return;        Console.WriteLine (Result);}}}  

Write the code and upload the code to Ubuntu.

Then run the program on Ubuntu and execute it successfully.

dotnet Restore

dotnet Build

Dotnet Run

Additional debugging

The program is then run by default and then attached to the process with VS 2017 Open debug

Select the connection type is SSH, then connect and target the Ubuntu IP, then enter, the dialog will pop up, enter the corresponding user name password.

Configuration:

Additional processes:

Select Type:

Then wait for a few characters in the Linux input, enter the broken down:

Attention:

If you find that the attachment cannot be broken, stop debugging, restart VS, and then exit the program, rerun and then attach. Try a few more times.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.