GordianDotNet / VSMonoDebugger

Enables Visual Studio 2017 to deploy and debug a mono application on remote linux machines via SSH.
MIT License
49 stars 25 forks source link
debugger mono remote ssh visual-studio-extension

Use at your own risk!

VSMonoDebugger2022 for Visual Studio 2022

Enables Visual Studio 2022 to deploy and debug a .Net application on a remote Linux machine with mono or dotnet core installed over SSH. Local debugging on Windows with installed mono is currently not supported.

VSMonoDebugger for Visual Studio 2017 and 2019

Enables Visual Studio 2017 and 2019 to deploy and debug a .Net application on a remote Linux machine with mono or dotnet core installed over SSH. Local debugging on Windows with installed mono is also supported.

For bugs with the latest version, an older version can be found here: MarketplaceReleases

Usage

Visual Studio 2022 Support with VSMonoDebugger2022

In Visual Studio 2022, I couldn't get a submenu in the extension menus. All menu entries are in the "Extensions" menu.

Visual Studio 2022 Extensions Menu

Visual Studio 2019 Support with VSMonoDebugger

In Visual Studio 2019, extension menus are handled differently. "Mono" can now be found in the "Extensions" menu.

Visual Studio 2019 Extensions Menu

.Net core Support

Since Version 1.2.0 you can deploy, run and debug .Net core applications on a remote linux machine with the help from vsdbg.

Prerequisite

You have to install/copy dotnet core runtime download and vsdbg (GetClrDbg) to the remote machine.

Don't forget to set the paths of dotnet and vsdbg in launch.json setting page!

Attach/Detach mode without deployment is possible see: debugging-net-core-on-unix-over-ssh. My problem: the remote machine have to have internet connection to download vsdbg otherwise the debugging process aborts.

See also: Wiki of MIEngine

Settings (Linux over SSH)

You have to save a valid SSH connection first!

Menu "Mono"/"Settings..."

VSMonoDebugger Settings

VSMonoDebugger Settings

VSMonoDebugger Settings

Use dotnet instead of mono

VSMonoDebugger Settings

VSMonoDebugger Settings

VSMonoDebugger Settings

Debugging (Linux over SSH)

VSMonoDebugger Settings

Deploy

You can deploy your "Startup project" output to the remote machine via SSH configured under "Settings".

Menu "Mono"/"Deploy only (SSH)"

Notice

To speed up deployment via SSH, SshFileSync is used.

To upload only changed files, an additional cache file '.uploadCache.cache' is stored in the destination folder. Don't delete this cache file unless the deployment does not transfer all files.

Debug

You can start a debug session in Visual Studio on the remote machine without deployment. Three steps are executed

Menu "Mono"/"Debug only (SSH)"

Deploy and Debug

You can run both commands in one step.

Menu "Mono"/"Deploy and Debug (SSH)"

Settings (Windows local machine)

Menu "Mono"/"Settings..."

VSMonoDebugger Settings Windows

VSMonoDebugger Settings Windows

Note: Scripts for Windows are running in a PowerShell environment!

Debugging (Windows local machine)

VSMonoDebugger Settings

Note: You have to install mono and include mono.exe to your PATH environment!

Deploy

You can deploy your "Startup project" output to the local Windows machine configured under "Settings".

Menu "Mono"/"Deploy only (Local)"

Debug

You can start a debug session in Visual Studio on the local machine without deployment. Three steps are executed

Menu "Mono"/"Debug only (Local)"

Deploy and Debug

You can run both commands in one step.

Menu "Mono"/"Deploy and Debug (Local)"

Debugging and Settings (Linux and Windows)

Attach to mono debugger (without SSH)

You can debug a mono process that is already waiting for a debugger. SSH is not necessary. Only one TCP connection is required. The mono process must be started manually with the necessary arguments. It is usefull if you have a embedded mono enviroment in a C++ application (see #5).

Menu "Mono"/"Attach to mono debugger (TCP)"

Build Startup Project with MDB Files

You can build the startup project and all dependent projects. Additionally the mdb files are created. This is necessary for the support "Attach to mono debugger (TCP)", because the mdb files must be present in every output directory of dependent projects.

Menu "Mono"/"Build Startup Project with MDB Files"

Overwrite the settings for a startup project

1) You have to enable the option via

Menu "Mono"/"Settings..."/"Overwrite settings with local VSMonoDebugger.(json|config) file in project folder"

2) You have to create a file with name 'VSMonoDebugger.json' or 'VSMonoDebugger.config' in the same directory like your startup project file.

In older versions (< 1.5.0) the file had to contain the project name: '[PROJECTNAME].VSMonoDebugger.config' (PROJECTNAME have to be the name of your project). ex.: 'MyNewSampleProject.csproj' results in 'MyNewSampleProject.VSMonoDebugger.config'

3) The file must contain a JSON object with properties from VSMonoDebugger/Settings/UserSettings.cs

If you want change the deploy path set "SSHDeployPath" ("WindowsDeployPath" for local Windows deployment):

{
    "SSHDeployPath": "./NewDeployPath/",
    "WindowsDeployPath": "C:\\DeployPath\\SecondSubFolder"
}

WARNING: WindowsDeployPath has to be json string conform - you have to escape "\" with "\\" characters!

Known Issues

Solved Issues

Version History for VSMonoDebugger2022

2.2209.1806

2022-09-18

2.2209.1800

2022-09-18

Used resources for VSMonoDebugger2022

Version History for VSMonoDebugger

1.5.1

2020-07-09

1.5.0

2020-05-17

1.2.0

2020-01-26

1.0.5

2020-01-12

0.9.5

2019-10-09

0.9.3

2019-06-20

0.9.0

2019-06-03

0.8.0

2019-05-05

0.7.8

2018-09-24

0.7.7

2018-09-13

0.7.6

2018-08-25

0.7.5

2018-07-11

0.7.0

2018-03-18

0.1.0

2018-01-20

Used resources for VSMonoDebugger