User Tools

Site Tools

한국어

cfnet:cfheader:vscode_remote_debug_configurator:index

Visual Studio Code .NET Remote Debug Configurator

Download

Overview

Visual Studio Code, with existing C# extensions, already has the ability to deploy to, launch, and debug an application on a remote target device. However, setting it up requires laboriously editing the .vscode/tasks.json and .vscode/launch.json files.

The .NET Remote Debug Configurator is a Visual Studio Code extension that simplifies the process of configuring remote .NET debugging sessions. Instead of manually editing JSON configuration files, developers only need to fill out a form.

Visual Studio Code also has the ability remotely develop and debug applications on a remote target, but on resource constrained devices, performance is slow, consumes too many resources on the target target, and it interferes with the normal operation of the application on the remote target.

Development should be done on a resource abundant development PC. The development PC will quickly build the application, deploy it to the remote target, launch it on the remote target, and attach the debugger with a single F5 keystroke. This extension makes setting that up a matter of simply filling out of small form.

Prerequisites

Setup Passwordless SSH Login

This extension requires Setup passwordless SSH login to avoid having to store a password insecurely in the target's configuration.

  1. On your development PC, generate a key pair
    ssh-keygen -t rsa

    The key pair will likely be stored in your user profile's home directory (i.e. $HOME/.ssh or on Windows C:\Users\{Username}\.ssh).

  2. Copy the public key to the remote target. Don't miss the trailing colon.
    scp $HOME/.ssh/id_rsa.pub admin@{remote_target_ip_address}:
  3. Register the public key as an authorized key on the remote target. On the remote target, run
    mkdir .ssh && cat id_rsa.pub >> .ssh/authorized_keys
  4. The next time you start an SSH session from your remote device, you should not be asked to authenticate with a password.

Install vsdbg on Remote Target

This extension requires Microsoft's vsdbg to be installed on the remote target. It is usually installed by default on COMFILE Technology's products. But if it's not, run the following command on the remote target to install it.

curl -sSL https://aka.ms/getvsdbgsh | sudo bash /dev/stdin -v latest -l /opt/Microsoft/vsdbg/

You can install it to a different location by changing the -l parameter. If you install it to a different location, then be sure to specify the location when configuring your remote target.

How to Use

Installation

Download the Extension

Install the Extension

  1. From the Extensions side panel in Visual Studio Code, select Install from VSIX.
  2. Browse to the downloaded .vsix file and press the “Install” button.

Create A Remote Debug Target

  1. Open your .NET project in Visual Studio Code
  2. Press Ctrl+Shift+P to open the command palette
  3. Type .NET Remote Debug Configurator and/or select .NET Remote Debug Configurator from the dropdown menu
  4. Fill out the configuration form with your remote debugging details

Manage Existing Configurations

When you open the configurator and have existing remote debug targets:

  1. Use the Remote Target dropdown to select which configuration to edit
  2. Modify any fields and click Save Configuration or press Enter to update
  3. Click Delete to remove a configuration and all its associated tasks

Start a Remote Debug Session

  1. Go to the Run and Debug panel (Ctrl+Shift+D)
  2. Select your remote debug configuration from the dropdown at the top
  3. Press F5 or click the green Start Debugging button

The extension will automatically:

  1. Deploy your application to the remote machine via SSH
  2. Start the application on the remote machine
  3. Attach the VS Code debugger through the SSH tunnel
  4. Connect you to the remote debugging session

Configuration Marking System

The extension uses a special comment marker (// Managed by dotnet-remote-debug-config) to identify configurations and tasks it creates. This allows it to:

  • Distinguish between extension-managed and user-created configurations
  • Safely update or delete only its own configurations
  • Automatically clean up associated tasks when deleting a debug profile

Please don't remote those comments from the .json files unless you no longer want this extension to manage those configurations.

cfnet/cfheader/vscode_remote_debug_configurator/index.txt · Last modified: by admin