Do you ever know we can do a remote .NET development and debugging using VS Code in Ubutun from Windows? It is just similar to what we can do our .NET development in WSL. Basically, what you require is just an SSH enabled Ubuntu and VS Code Remote - SSH extension on your Windows.

First thing first, what the pre-requisite is an SSH server on Ubuntu, if you haven't setup, you can try google around to install or check this post > Raspberry Pi & Ubuntu SSH Login Without Password from Windows.

After that, open your VS Code on Windows and install the Remote - SSH published by Microsoft.


Reopen the VS Code, you should be able to see a new Remote Explorer Icon on the left (1), click it and change the drop-down list to SSH Targets (2) if not yet selected. Then, click the SSH TARGETS on (3), you will be able to see an Add button as (4). As (5), key in your SSH information e.g. ssh userid@192.168.0.2. Follow the instructions and this will be registered the Ubuntu SSH to the VS Code.


After that, reopen the VS Code, and go the Remote Explorer again, you will able to see the Ubuntu IP address. Right click and connect it.


VS Code will restart and you can go to Explorer and click Open Folder. The path listed will be Ubuntu folders.

If you have an existing .NET project in Ubuntu, try to open it and add the assets for VS Code. After added, you will be able to develop .NET with IntelliSense and debug the .NET project on Ubuntu.

If you don't have the .NET project on Ubuntu, you can open the VS Code terminal, it will be the Bash for Ubuntu. You can run dotnet new to create a new .NET project on Ubuntu and do the remote development and debug on Windows.

FAQ
Q: You received this error message during you launch the project for debug > The terminal process failed to launch: Path to shell executable "dotnet" is not a file or a symlink.
A: Please make sure the Ubuntu dotnet path is correct. You can specify the full path in .vscode/tasks.json.

  {      "version": "2.0.0",      "tasks": [          {              "label": "build",              "command": "dotnet",              "type": "process",              "args": [                  "build",                  "${workspaceFolder}/razorapptest.csproj",                  "/property:GenerateFullPaths=true",                  "/consoleloggerparameters:NoSummary"              ],              "problemMatcher": "$msCompile"          },  

This free site is ad-supported. Learn more