Remotely deploy and debug your .NET C# apps via SSH to Linux using Visual Studio 2022.
Get it on the VS MarketPlace!
Visual Studio's "attach to process via SSH" is cute, but it lacks deployment and automatic attaching. This project allows you to do just that on your Linux VM or Raspberry Pi over the network!
Suess Labs consulting is sponsored by Xeno Innovations, Inc.
Now developers can build, deploy and debug projects on their remote Linux (Ubuntu, Raspberry PI, etc) devices! Customize your SSH connection to use either a password or a private key.
The following Linux distrobutions have been validated and are supported.
- Ubuntu (20.04 LTS, 22.04 LTS)
- Raspberry PI OS
- Build and upload to remote devices
- Remote debugging*
- This is still in the experimental stages. Please use VS' Attach to Process if you have issues
- VS Linux Debugger will automatically detect and install
vsdbg
for you!
For GUI app debugging, you can use the Build and Deploy feature, however, you must manually Attach to Process via SSH using Visual Studio at this time.
Linux, we'll need SSH and cURL for access and downloading any missing tools:
sudo apt install openssh-server
sudo apt install curl
Windows:
- Open Visual Studio (VS) > Tools > Options > Linux Debugger
- Input: Remote Host IP address
- Input: Remote's User Name and Password
- VS > Extensions > Linux Debugger > Build, Deploy, Debug
For GUI projects, you can use Build and Deploy and then manually attach to the process via SSH by using Visual Studio's built-in tool
- Deploy to remote machine via
- Extensions > Linux Debugger > "Build and Deploy"
- Run GUI app on remote machine
dotnet MyGuiApp.dll
- Debug > "Attach to Process.."
- Connection Type: SSH
- Connection Target: (Remote machine's IP)
- (Select process)
- Click, Attach
- Check, "Managed (.NET Core for Unix)"
- Click, OK
This will save you 1.5 minutes on every build of manual uploading and updating rights via chown -R
.
The following steps are options if you wish to use an SSH Private Key. These steps were written for Windows 10, however, on Linux the steps are similar.
- Open PowerShell:
- Generate key (with old PEM format)
ssh-keygen -m PEM -t rsa -b 4096
- In the future, we'll be able to use
ssh-keygen
.. just not yet.
- Set output name (default is okay for basic setups)
- Input a passphrase for the key (OPTIONAL)
- Windows will now generate your RSA public/private key pair.
- Default location:
%UserProfile%\.ssh
(WINOWS) - The public key will be stored as
id_rsa.pub
in the directory
- Default location:
- Upload the public key to your remote machine
- Navigate to folder,
~/.ssh/
on Linux device - If
~/.ssh/authorized_keys
exists, append the contents ofid_rsa.pub
to the next line. - If it does not exist, simply upload
id_rsa.pub
and rename it to,authorized_keys
- Navigate to folder,
- DONE!
- Debugging: Launching of GUI apps for remote debugging
- Debugging: PLink using PPK instead of manual password
- Options Window: Multiple remote profile management
- Options Window: SSH PPK generator assistant tool
Contributors and Q/A are welcomed!
To contribute, please pick off an item from the project or issue page. We'd love to hear your enhancement ideas as well.