Setting up a dotnet dev environment with WSL and Ubuntu 24.04
Posted on
I just knew 2026 was going to start off this way... A complicated setup to do something that should be simple.
Ok, so you want to do some .NET dev work with WSL? Better not choose Ubuntu 24.04 as your distro. I guess this version doesn't ship with some important packages that are needed to make some interop work between Windows and Linux. Anyways, let's get to the steps!
Configure Git for authentication with Azure DevOps
Make sure you have installed Git For Windows on your host machine. Your git installed in Linux will need to use the credential manager in Windows.
Configure the credential helper: git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/bin/git-credential-manager.exe"
Configure using HTTP: git config --global credential.https://dev.azure.com.useHttpPath true
Set environment variable in ~/.bashrc to force a dialog to popup for authentication so you don't end up using Device Flow (which some tenants, like mine, disallow)
Install packages that allow the browser to be opened from MSAL This part is crucial. When you run dotnet restore --interactive, MSAL will want to open your system's browser so you can use OAuth to sign in and provide credentials for your Azure DevOps instance. Install these packages, which no longer ship with Ubuntu:
apt update
apt install xdg-utils
apt install wslu
wslu is a discontinued project that consisted of utilities for WSL and xdg-open is a program that will open the system's browser.
Edit: If WSL interop stops working You may need to add a WSL interop config (source)
sudo vim /usr/lib/binfmt.d/WSLInterop.conf
Add this line:
:WSLInterop:M::MZ::/init:PF