To debug a .NET application with WSL

Ensure you have the following software and components installed and configured:

To debug your .NET application with WSL:

  1. Open the project in Visual Studio.
  2. Open the project's properties, and click the Debug tab.
  3. Set Profile to WSL.
  4. Set Launch to WSL2, then save your changes.
  5. On the standard taskbar of Visual Studio, set the launch profile to WSL:

  6. Press WSL in the launch profile to start debugging.

    This compiles your project, mounts the Windows drive into WSL, and starts the debugger.

  7. Step through your application and use the Visual Studio debug features as usual.