Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I select Edge profile launched when debugging in Visual Studio 2022

Is there a way to tell Visual Studio 2022 which Edge profile to launch when debugging a docker app?

They seem to have removed the "Browse With" option that let you define a new browser with parameters and only allow you select Edge, Chrome, Firefox, etc. with not parameters.

My default profile is "Work", which uses the new Edge for business but Visual Studio keeps launching my personal profile. This is problematic as all my saved passwords that I need to use when debugging are in the "Work" profile.

like image 735
Mog0 Avatar asked Oct 11 '25 16:10

Mog0


2 Answers

Which type of project are you debugging?

To configure Visual Studio to launch the browser with your 'work' profile you'll need to:

  1. Go to the Browse with... option: (Can you see this option? )

enter image description here

  1. Click Add... a new browser:

enter image description here

  1. Configure the path to your browser, and use a custom --user-data-dir argument pointing to your user data folder

enter image description here
In my PC they are:

C:\Program Files (x86)\Microsoft\Edge Beta\Application\msedge.exe --user-data-dir="C:\Users\AppData\local\Microsoft\Edge Beta\User Data"

  1. And then optionally set it as the Default browser if you choose to.
  2. Browse with your 'work' profile.
like image 120
Elin Lu Avatar answered Oct 16 '25 09:10

Elin Lu


Elin's answer will launch the browser with the default profile. However, if your goal is to launch in a specific profile, then you should use the --profile-directory argument.

You can find the profile directory for any profile using the PowerShell snippet below. It will list all Edge profiles by profile name and folder name.

$EdgeProfiles = gci "$env:LOCALAPPDATA\Microsoft\Edge\User Data\" -Filter "Profile*"

ForEach($EdgeProfile in $EdgeProfiles.Name) { 
  $Preferences = "$env:LOCALAPPDATA\Microsoft\Edge\User Data\$EdgeProfile\Preferences"
  $Data = (ConvertFrom-Json (Get-content $Preferences -Raw))
  $profileName = $Data.Profile.Name
  "$profileName,$EdgeProfile"
}

Then the argument textbox in Visual Studio would contain this text:

--profile-directory="Profile 4"

assuming that the profile you wish the launch with is in the Profile 4 folder.

like image 44
SvenAelterman Avatar answered Oct 16 '25 10:10

SvenAelterman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!