Visual studio browser launch settings


Visual studio

This is going to be a very short post. I am adding it because I have run across it several times and every time I need to Google it (or ask a co-worker) how to fix it.

Why is my browser launching a new window?

When you run your web application one of two things may happen:

Your application may open in:

  • A new browser tab opens in current web browser
  • New web browser opens.

The issue with this is that when it opens in the current web browser if you close the tab the application will continue to run. However if you close it when it has opened in a new web browser window then your application will stop.

Open in current browser

If you want want it to open in a new tab in your current browser then you will need to disable JavaScript debugging for ASP.Net. Go to Tools -> Options -> Debugging -> General Make sure the option is unchecked.

tools -> options -> Debugging -> General



How to not launch a browser.

Go to the launchSettings.json file in your Visual studio project, look for the following line.

“launchBrowser”: true,

change it to

“launchBrowser”: false,

This will stop it from launching a browser at all.

Conclusion

JavaScript debugging for ASP.Net defines if the browser will open in a new tab or a whole new browser window. The launchSettings.json file gives you the ability to set how you want your web application to start up. You can start it up in a browser or not. Depending upon where the browser window was open may effect whether or not you application will continue to run when the browser is closed.


About Linda Lawton

My name is Linda Lawton I have more than 20 years experience working as an application developer and a database expert. I have also been working with Google APIs since 2012 and I have been contributing to the Google .Net client library since 2013. In 2013 I became a a Google Developer Experts for Google Analytics.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.