Skip to content

Configuring

Damian edited this page Oct 14, 2022 · 1 revision

This document outlines the process for installing everything from scratch.

Though this project supports everywhere that .NET (Core) is supported, this section outlines steps for Ubuntu 22.04 LTE. It's recommended to use the official Microsoft Install .NET on Linux guide.

If this is a new Ubuntu VM on Virtual Box, don't forget to install the extensions $ sudo apt install virtualbox-ext-pack

Linux Configuration

Before getting started, make sure your system has the latest updates.

Linux Prerequisites

On your Linux machine install OpenSSH Server and cURL.

sudo apt update
sudo apt install openssh-server
sudo apt install curl

Now test your connection on Windows

ssh USERNAME@IPADDRESS

Install .NET 6

Run the following commands to add the Microsoft package signing key to your list of trusted keys.

wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb

Next, install the SDK

sudo apt-get update; \
  sudo apt-get install -y apt-transport-https && \
  sudo apt-get update && \
  sudo apt-get install -y dotnet-sdk-6.0

For other .NET versions reference the table below

.NET Version DotNet-SDK-XX.XX
6.0 dotnet-sdk-6.0
5.0 dotnet-sdk-5.0
3.1 dotnet-sdk-3.1

Install Extension

Alternatively, you can manually download it from the Visual Studio Marketplace

  1. Open Visual Studio
  2. Extensions > Manage Extensions
  3. Search for "VS Linux Debugger"
  4. Install and restart Visual Studio

Configure the Extension

First, get your remote machine's IP ($ ifconfig)

  1. Visual Studio > Tools > Options
  2. Select, "Linux Debugger" from the treeview
  3. Input: Remote Host IP Address
  4. Input: User Name and Password
  5. Click, OK

Deploy and Debug

Now you're ready to deploy and debug your applications! We'll begin by making a new .NET 6 Console application.

Deployment logging is displayed in the Output Window's "Linux Debugger" dropdown.

Console Debugging

After setting your breakpoint, you can now Deploy and Debug!

  1. Visual Studio > Extensions > Linux Debugger
  2. Select, Build, Deploy and Debug

GUI Debugging

To debug Linux GUI applications debugging, I'm currently working on a solution for that. For now, you can still use Build and Deploy followed by manually attaching to the process in Visual Studio to debug it.

  1. (VS) Linux Debugger > Build and Deploy
  2. Run the app on the remote machine via, dotnet MyApp.dll
  3. (VS) Debug > "Attach to Process..."
  4. Connection Type to, SSH
  5. Connection Target: "UserName@IPADDRESS" <enter>
    • If its the first time connecting to the machine
    • Input user credentials. Click, Connect
  6. Check, Managed (.NET Core for Unix)

Your system should begin debugging.