Visual Studio Debugging with Edge Profile

David Lee
2 min readJul 12, 2021

--

With Visual Studio, we can already debug with Edge browser and choose it as a default browser to use. As with any modern browser, Edge has the ability to switch between profiles. When testing my web application where it involves authenticating with different test users, I would like Visual Studio to launch with an Edge profile of my choosing.

Visual Studio enables us to choose a browser and pass in arguments to the browser when debugging. This is done by clicking on the debug dropdown and selecting “Browse With…”, then “Add”.

The command line for Edge is with the profile directory argument with a Profile number.

--profile-directory="Profile 10"

To find the right Profile number, use the following PowerShell script.

Push-Location "$env:LOCALAPPDATA\Microsoft\Edge\User Data\"; Get-ChildItem -Filter "Profile *" | ForEach-Object { $dirName = $_.Name; $p = (Get-Content "$dirName\Preferences" | ConvertFrom-Json); $p.profile.name + "," + $_.Name }; Pop-Location

This produces an output with the name of the profile and the profile number.

Now, we will be able to tell which profile to use. Finally, we can Add the appropriate values.

Lastly, we will want to set that profile as Default and click Browse to persist the settings. That’s it. This is how we will now be able to debug with a specific profile in Edge.

--

--

David Lee

Cloud Solution Architect/Software/DevOps Engineer