Use at your own risk!
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.
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
In Visual Studio 2022, I couldn't get a submenu in the extension menus. All menu entries are in the "Extensions" menu.
In Visual Studio 2019, extension menus are handled differently. "Mono" can now be found in the "Extensions" menu.
Since Version 1.2.0 you can deploy, run and debug .Net core applications on a remote linux machine with the help from vsdbg.
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
You have to save a valid SSH connection first!
Menu "Mono"/"Settings..."
- [1] Selects the connection to use for deploying and debugging
- [2] You can create a additional setting
- [3] You can remove a setting (The last connection can not be deleted)
- [4] Enter a description (Useful to distinguish different settings with the same IP.)
- [5] If disabled SSH remote (Linux) deployment is used. If enabled local (Windows) deployment is used.
- [6] Enter the remote SSH IP or host name
- [7] Enter the SSH port
- [8] Enter the SSH username
- [9] Enter the SSH password or private key file passphrase (if there is no password => leave the field empty)
- [10] Enter/set the filepath to a private key file (if there is no ssh private key authentication => leave the field empty)
- [11] This is where the project output is deployed
- [12] If enabled you can create a JSON config file to overwrite the settings for each project. (see below)
- [13] Mono debugger tries to connect to the mono process via this port.
- [14] Connection attempts to a running / waiting mono process (useful for attach mode)
- [15] Time (ms) between two connection attempts
- [16] Console outputs can be output in the Visual Studio Output window
- [17] All changes are saved and dialog is closed if you click on "Save"
- [18] All changes are discarded and dialog is closed if you click on "Cancel"
- [19] Save all settings to a external json file via "Save to file ..."
- [20] Load all settings from a external json file via "Load from file ..."
- [21] Change the default debugging scripts on tab "Debug scripts". (ex.: to add sudo)
- [1] Change the Pre-Debug script to kill old mono debug sessions. Not necessary, if you make sure that all old mono debug process have been terminated.
- [2] The default Pre-Debug script is loaded if you click on "Set default Pre-Debug script"
- [3] Change the Debug script to start a mono debug session or a embedded mono application
- [4] The default Debug script is loaded if you click on "Set default Debug script"
- [5] For further script information click on "Script information"
- [1] Information about all supported parameters
- [1] If enabled the dotnet core runtime and vsdbg is used (Debug/Deploy on local Windows will be diabled)
- [2] Set the paths of dotnet and vsdbg in launch.json (Important!)
- [1] You can change the content of launch.json
- [2] Please set the path to vsdbg
- [3] Please set the path to dotnet runtime
- [4] The default launch.json is loaded if you click on "Set default launch.json"
- [5] For further information click on "Script information"
- [1] Information about all supported parameters
You can deploy your "Startup project" output to the remote machine via SSH configured under "Settings".
Menu "Mono"/"Deploy only (SSH)"
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.
You can start a debug session in Visual Studio on the remote machine without deployment. Three steps are executed
- [1] The Pre-Debug script is called on the remote host to terminate old mono debug processes
- [2] The Debug script is called on the remote host to start a new mono debug process
- [3] VSMonoDebugger tries to attach itself via the mono debug port using tcp
Menu "Mono"/"Debug only (SSH)"
You can run both commands in one step.
Menu "Mono"/"Deploy and Debug (SSH)"
Menu "Mono"/"Settings..."
- [5] If enabled local (Windows) deployment is used. If disabled SSH remote (Linux) deployment is used.
- [2] This is where the project output is deployed on the local windows machine.
- [3] If enabled you can create a JSON config file to overwrite the settings for each project. (see below)
Note: Scripts for Windows are running in a PowerShell environment!
- [1] Change the Pre-Debug script to kill all mono processes. Not necessary, if you make sure that all old mono debug process have been terminated.
- [2] The default Pre-Debug script is loaded if you click on "Set default Pre-Debug script"
- [3] Change the Debug script to start a mono debug session or a embedded mono application
- [4] The default Debug script is loaded if you click on "Set default Debug script"
- [5] For further script information click on "Script information"
Note: You have to install mono and include mono.exe to your PATH environment!
You can deploy your "Startup project" output to the local Windows machine configured under "Settings".
Menu "Mono"/"Deploy only (Local)"
You can start a debug session in Visual Studio on the local machine without deployment. Three steps are executed
- [1] The Pre-Debug script is called to terminate old mono debug processes (Currently all mono processes!)
- [2] The Debug script is called to start a new mono debug process
- [3] VSMonoDebugger tries to attach itself via the mono debug port using tcp
Menu "Mono"/"Debug only (Local)"
You can run both commands in one step.
Menu "Mono"/"Deploy and Debug (Local)"
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)"
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"
- You have to enable the option via
Menu "Mono"/"Settings..."/"Overwrite settings with local VSMonoDebugger.(json|config) file in project folder"
- 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'
- 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!
-
Debug scripts doesn't support cancellation. Powershell scripts with ""Redirect Output on"" doesn't stop.
-
Support prerequisite Microsoft.VisualStudio.Component.MonoDebugger without copying the dlls (Makes problems with Xamarin's debugger) If you are using Xamarin and debugging fails, please disable VSMonoDebugger!
-
Support settings in an Options Page
-
Code has to be refactored for better error logging
-
Why can't the Mono.Cecil.Pdb.NativePdbReaderProvider type be found in Visual Studio to support pdb files?
-
Sometimes errors (like collection was modified) are thrown and you have to restart the debugging process.
-
Use putty to do ssh stuff
-
dotnet core debugging support is experimental (use IVsDebugger4 to set launch.json without file creation)
-
Make the deployment for vsdbg and dotnet easier
-
Support dotnet attach mode for a running process see: debugging-net-core-on-unix-over-ssh
-
Arguments for dotnet have to set in launch.json
- Script to stop running mono debug process has dependencies (workaround depends on installed packages)
- Support break points in referenced projects. *.mdb files are searched locally in each output directory, so we need mdb files in each project output directory (see Mono.Cecil.Cil.DefaultSymbolReaderProvider.GetSymbolReader()).
- Ignore unsupported project types (like C++, VB, F#)
- Under Ubuntu replace the Pre-Debug script with
pkill -f mono
to kill old mono debug sessions. And give your user root rights forpkill
andmono
see: Run a specific program as root without a password promt
# User alias specification
yourUserName ALL=(ALL) NOPASSWD: /usr/bin/pkill, /usr/bin/mono
- Support ssh private key authentication to authenticate
- When using the ProvideAutoLoad attribute, your package (VSMonoDebugger.VSMonoDebuggerPackage) class should derive from AsyncPackage instead of Package to improve performance. Read more about using AsyncPackage here: https://aka.ms/asyncpackage. Visual Studio 2019 shows a warning
- CPU consumption when reading the output reduced
2022-09-18
- Feature: Powershell scripts and debugging with Mono under Windows is supported with VSMonoDebugger2022 Windows debugging supported again!
2022-09-18
- Feature: #28 Created a new project VSMonoDebugger2022 to support Visual Studio 2022
- You have to install Xamarin components with Visual Studio 2022
- Powershell scripts under Windows currently not supported with VSMonoDebugger2022 Windows debugging not supported!
- Visual Studio Image Library 2017
- pdb2mdb source code
- PowerShell
- plink.exe 64Bit
- Mono debugger-libs stored in directory VSMonoDebugger2022/Mono.Debugging.Soft - Debug build from commit f7085b2d81cdf1acb85189428c149ac5b98b6bbc
- NRefactory requirement for debugger-libs - Debug build from commit f324292309954600222734e66471d58e338352f5 - Must be cloned side by side with debugger-libs.
- Nuget Mono.Cecil 0.11.4
2020-07-09
- Bugfix: #14 Add the Solution Platform Configuration (AnyCPU, x86, ...) when building with extension
2020-05-17
- Bugfix: #20 Don't log a private key issue if we don't use it (empty string)
- Bugfix: #17 reduced cpu usage (from kptnk)
- Feature: Support shorter filenames for local project config (VSMonoDebugger.config and VSMonoDebugger.json) (from kptnk)
- Feature: Local project config file can overwrite whole UserSettings properties: VSMonoDebugger/Settings/UserSettings.cs
2020-01-26
- Feature: Better logging support ('Enable verbose debug logging' in settings)
- Feature: Support dotnet core debugging via vsdbg, launch.json and DebugAdapterHost.Launch for Linux. See Offroad Debugging of .NET Core on Linux OSX from Visual Studio
2020-01-12
- Feature: Local Windows support for Deployment and Debugging added (scripts run in PowerShell)
- Feature: MaxConnectionAttempts and TimeBetweenConnectionAttemptsInMs support added (Debug connection timeout removed - didn't work)
- Feature: Show IP in menu text
- Feature: Support "Save as ..." and "Load from ..." for setting dialog
- Change: Allow empty scripts (don't use default script)
2019-10-09
- Bugfix: Set the parent window handle for the setting dialog
- Bugfix: GitHub Security Warning: vulnerability found in SharpCompress < 0.24
2019-06-20
- Bugfix: #11 Revert package reference update to support older version of visual studio 2017 (15.0.x)
- Bugfix: Support Visual Studio 2019 16.x version numbers (before only 16.0)
- Bugfix: #11 Program Output wasn't printed into output window anymore
2019-06-03
- Feature: Switched to AsyncPackage to avoid warning in Visual Studio 2019
- Feature: Supports a separate deployment path for each startup project via PROJECTNAME.VSMonoDebugger.config in the project folder
- Bugfix: #7 Catch exception of unsupported setup projects .vdproj
- Bugfix: #10 Allow only IPv4 for the result of Dns.GetHostAddresses - IPv6 is not supported by mono softdebugger
2019-05-05
- Feature: Support Visual Studio 2019
- Bugfix: Include System.Diagnostics.Tracer.dll - is not installed on some systems
2018-09-24
- Feature: Support ssh private key authentication
2018-09-13
- Bugfix: Fixed build error if solution has other project types like C++ (only CSharp projects are built)
2018-08-25
- Bugfix: Support break points in referenced projects. *.mdb files are searched locally in each output directory, so we need mdb files in each project output directory.
- Feature: Build only startup project instead of whole solution and show error window automatically
- Feature: Add new menu item "Attach to mono debugger (without SSH)"
- Feature: Add new menu item "Build Startup Project with MDB Files"
2018-07-11
- Bugfix: NullReference in UserSettingsContainer fixed
- Bugfix: Visual Studio 2017 doesn't include Newtonsoft.Json.dll anymore. See newtonsoftjsondll-not-included-in-vsix
- Bugfix: Load default UserSettings without username and password instead of NullReferenceException
- Feature: Support custom debug scripts. (ex. to support sudo or additional preparations.)
- Feature: Error logging and handling improved for StartDebuggerAsync if a script has syntax errors.
2018-03-18
- Support fast deployment with SshDeltaCopy
- Integrate the Xamarin Mono Debugger (Mono.Debugging.VisualStudio.4.9.10-pre)
- Create mdb files before deployment with a integrated pdb2mdb function
- Manage multiple ssh connections (deployment devices)
- Show standard output in the Visual Studio Output window
- Support embedded devices (Testet on a Raspberry 2 with Yocto Linux version 4.9.27 and Mono 5.4)
2018-01-20
- Start project