Run and debug your .NET Core console and web applications in WSL 2.
The .NET Core Debugging with WSL 2 – Preview extension lets you run and debug your .NET Core console and web applications in WSL 2 from Visual Studio. This allows Windows developers targeting Linux production environments to have a higher fidelity local debugging experience.
Get started with .NET Core Debugging with WSL 2
Open an ASP.NET Core web app or .NET Core console App
Change the Launch Profile to “WSL 2”
Note: If you want to verify that your code is running in WSL 2, you can check the value of Environment.OSVersion
Authenticating to Azure services using the credentials from VS is not supported. The easiest way to authenticate with Azure in your app in WSL 2 is to use Azure.Identity (1.2.0-preview.1 or newer), install the Azure CLI in your WSL 2 distribution and run az login.
ASP.Net Core development certificates are not trusted within WSL 2. Any service to service calls over HTTPS will need to handle allowing the untrusted development certificate when running locally.
Blazor Web Assembly Debugging is not currently supported.
The enabled key of the automount section in the wsl configuration file must be left at its default value of true.