Pages

Monday, September 20, 2021

Stop Creating New Windows & Tabs When Debugging

By default, Visual Studio launches web applications in a new browser window when debugging. It also closes your browser window when you stop. While I prefer publishing my web applications locally, Optimizely runs well from Visual Studio, and it's easier to debug initialization modules and other items this way. However, when you want to leave the page or content open, this behaviour can get in the way. This is how you change that.

To stop Visual Studio from opening a new browser window or tab when debugging locally, follow these steps:

  1. Open the Application Debug Properties using the Debug menu -> [Project name] Debug Properties

    Alternatively, you can also get to the Debug Properties using these methods:
    1. Right click on the Web Application in Solution Browser and select Properties. Then select the Web tab.
    2. Go to the Project menu -> [Project name] Properties and select the Web tab.

  2. Select "Don't open a page. Wait for a request from an external application."


To stop Visual Studio from closing your tabs when debugging locally, follow these steps:

  1. Navigate to Tools -> Options -> Projects and Solutions -> Web Projects

  2. Uncheck "Stop debugger when browser windows is closed, close browser when debugging stops"

    * Note: In versions of Visual Studio older than 2019, this might be labeled, "Stop debugger when browser window is closed"

An alternative configuration for the Start Action

If you often open your application to the same page when debugging, an alternative to disabling the Start Action is to set it to the page you most often load. For example, I frequently load the Episerver/CMS page when debugging. If I set the Start URL value to that path, it loads into the CMS experience when I start the application debugger.


No comments:

Post a Comment

Share your thoughts or ask questions...