Ensure you have the following software and components installed and configured:
- WSL and a Linux distribution supported by
. See the MSDN for information on how to install this and how to configure your Windows machine.
- Install
in WSL.
- Ensure your Visual Studio has the
.NET Debugging with WSL component installed. See
To install missing features from the IDE.
- Enable the
Use new project system for .NET SDK projects setting in Visual Studio - in
.
To debug your .NET application with WSL:
- Open the project in Visual Studio.
- Open the project's properties, and click the
Debug tab.
- Set
Profile to
WSL.
- Set
Launch to
WSL2, then save your changes.
- On the standard taskbar of Visual Studio, set the launch profile to WSL:
- Press
WSL in the launch profile to start debugging.
This compiles your project, mounts the Windows drive into WSL, and starts the debugger.
- Step through your application and use the Visual Studio debug features as usual.