是否有办法让VS Code在Chrome中打开一个新窗口,而不是使用现有的Chrome窗口并打开一个新的选项卡?(我希望每个调试会话都以一个干净的HttpContext.Session开始)。
这是我的launch.json:
{
"name": "Development",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net7.0/Nexgen.dll",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"serverReadyAction": {
"action": "openExternally",
"pattern": "\bNow listening on:\s+(https?://\S+)"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
},
"launchSettingsProfile": "Development"
}
我尝试了以下操作,但没有成功:
- 添加
"args": [ "--new-window" ]
设置到我的launch.json
文件 - 添加一个新任务到'startChrome'并调用它和'build'。它确实启动了一个新的Chrome窗口,但调试器仍然附加到/启动在先前运行的浏览器。
{
"label": "startChrome",
"type": "process",
"command": "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe",
"args": [
"--new-window",
"http://localhost:5000"
],
"problemMatcher": []
}
- 添加
"commandLineArgs": "--new-instance http://localhost:7058",
到我的launchSettings.json
文件
通过在launch.json中设置serverReadyAction.action = debugWithChrome
来解决这个问题。