Attaching WSL2 application
WSL2 is an incredible tool allowing debugging and running of Linux applications from the Windows host. It's possible to follow the same instructions and install full Developer Tools process in the WSL2 system, potentially duplicating installation with the Windows version.
But for convenience of keeping single installation it is recommended to attach Linux running application to the Windows running Developer Tools instance.
-
Follow Getting Started instructions for initial setup and nuget packages installation.
-
Configure WSL2 machine once:
-
(Preferred) Setup WSL2 mirrored mode networking, as specified in Mirrored mode networking documentation. This mode makes Windows
localhostdirectly accessible on WSL instance. No extra configuration and code changes is required. -
(Alternative) Retrieve Windows host IP address following WSL2 documentation: Accessing Windows networking apps from Linux (host IP). Which then can be used in your
AttachDeveloperToolsoptions:
this.AttachDeveloperTools(o =>
{
o.Protocol = DeveloperToolsProtocol.CreateHttp(IPAddress.Parse("YOUR_LOCAL_NETWORK_HOST_IP"));
}); -
-
Run
Developer Toolsinstance on your Windows host machine. Typically viaavdtdotnet tool command line. -
Run your Linux app and attach to
Developer Toolsvia F12.
