You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Visual Studio 2022调试时指定启动的Edge配置文件?

解决Visual Studio 2022调试Docker应用时指定Edge配置文件的问题

试试这几个办法来指定Edge的工作配置文件:

方法一:修改项目调试配置文件

  • 找到项目根目录下的Properties/launchSettings.json
  • 定位到Docker相关的调试节点,在里面添加浏览器路径和启动参数:
"Docker": {
  "commandName": "Docker",
  "launchBrowser": true,
  "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
  "environmentVariables": {
    "ASPNETCORE_URLS": "https://+:443;http://+:80"
  },
  "publishAllPorts": true,
  "useSSL": true,
  "browser": "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe",
  "arguments": "--profile-directory=\"Profile 1\""
}

注意:--profile-directory的值要对应你「Work」配置文件的实际目录名,打开Edge输入edge://version/,查看「个人资料路径」的最后一段就是这个值

方法二:添加自定义外部工具

  • 打开VS2022顶部菜单「工具」→「外部工具」
  • 点「添加」,填入以下信息:
    • 标题:Edge 工作配置文件
    • 命令:C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe
    • 参数:--profile-directory="Profile 1" $(TargetURL)
    • 初始目录:留空
  • 保存后,在项目调试的浏览器选择下拉框里就能看到这个自定义选项,选它就行

方法三:修改VS全局浏览器配置

  • 打开路径%APPDATA%\Microsoft\VisualStudio\<你的VS版本号>\BrowserLink\browsers.json
  • 找到Edge的配置项,添加启动参数:
{
  "name": "Edge",
  "path": "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe",
  "arguments": "--profile-directory=\"Profile 1\"",
  "isDefault": false
}
  • 保存后重启VS,下次选Edge调试就会自动用指定的配置文件

内容的提问来源于stack exchange,提问作者Mog0

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 21:07:41