Run and debug your .NET Core console and web applications in WSL 2.
Now included in Visual Studio 2019!
This extension is now available as an optional feature in Visual Studio 2019 v16.9 Preview 1 and will no longer be updated on the marketplace. To download the preview goto https://aka.ms/vspreview
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”
Press F5
Note: If you want to verify that your code is running in WSL 2, you can check the value of Environment.OSVersion
Name of the distribution to run in, or "" to use the default distribution.
""
executablePath
Path to run
dotnet
commandLineArgs
Arguments to pass to executablePath
The projects output assembly.
workingDirectory
The directory in which to start executablePath
For ASP.NET Core web apps, the project folder; for .NET Core console Apps, the output folder.
environmentVariables
List of environment variables to set for executablePath.
null
launchBrowser
Whether or not to launch a browser.
false
launchUrl
Url to use for launching a browser.
null
What's new in 0.2
Support for choosing the distribution to use.
Support for custom values of automount:root.
Removed the dependency on Debian's dpkg command.
Some smaller bug fixes.
Known Issues
[Only on Visual Studio 2019 v16.9 Preview 1] If a preview version of .NET 5.0 has been installed in the WSL distribution you will not be prompted to install the released version. To fix this you will need to manually install .NET 5.0 using the instructions here
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.