Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent Visual Studio 2022 from opening a new browser, but instead open in a new tab

Before you go crazy: Yes, this is a duplicate of this, this, this, and this. Probably a lot more, but these were the first results when searching.

I'm running VS 2022 Preview 5.0, I've created a Blazor WASM project, and I've tried every single suggestion I could find to stop VS from opening a new browser but instead open in a tab. I'm also running Windows 11, which might cause some weird issues with "default apps", but I did check and all my .html, HTTP, HTTPS, etc. links are set to open in Google Chrome.

Here is a video showing that I already have Chrome open, I have disabled Stop debugger when browser window is closed, close browser when debugging stops and Enable JavaScript debugging for ASP.NET (Chrome, Edge and IE): https://i.imgur.com/azLDram.mp4

I also tried enabling both, saving, disabling them again, and then saving.

Did Microsoft introduce a new 3rd thing that might cause this to happen, or am I just running a bugged version of Visual Studio?

EDIT: I just completely removed VS 2022 Preview 5.0 and installed VS 2022 17.0.5 (not Preview), and the problem still occurs.

EDIT 2: When I hit CTRL + F5 it opens a new tab in my existing Chrome window (as expected), but I want debugging at some point. This is so weird.

EDIT 3:

I found a possible solution, but there is a downside to it.

launchSettings.json has an inspectUri:

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:57110",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

If I remove that inspectUri property, it will open a new tab instead of a window. However, none of my debug symbols are loaded, which means I can't set a breakpoint and debug the code. The symbols are loaded if I keep the launchUri and I use the Chrome window instead.

If I then keep the window open, but I open the URL in my regular Chrome window, I still cannot debug. Debugging only works if I use the window Visual Studio opens for me. I guess this is intentional for Blazor WASM projects, but it is really annoying.

like image 758
MortenMoulder Avatar asked Nov 28 '25 09:11

MortenMoulder


1 Answers

turning off this setting worked for me

enter image description here

like image 179
kurdemol94 Avatar answered Dec 01 '25 00:12

kurdemol94