Visual studio 2017 debug opens new browser [duplicate] - debugging

I've been updating to the latest version of Visual Studio Preview and I think a setting has been changed.
When I start debugging an ASP.NET web app in Visual Studio 2017 15.7.0 Preview 4, VS opens a new browser.
I've had a similar issue before and it was a setting. This time it's not that setting. As you can see below, my Chrome debugging is already unchecked.
I'm also aware of the check box to "Launch Browser" under Project -> Properties.
If I uncheck that no browser is opened. The previous behavior which I really liked was to open a new tab in my default browser i.e. Chrome.
How do I restore that behavior? I'd like VS to automatically open a new tab in Chrome and if I have no browser open, only then it should open up a new browser.

After updating Visual Studio to the latest version 15.7.0 I ran into the same issue. In my case each time I debugged my project it opens up two new instances of Chrome.
As this was not annoying enough, each time I was moving the window to my second screen, the debug-session stopped immediately.
I've searched the Visual Studio options for browser and found a setting called
Stop debugger when browser window is closed
which could be found under Projects and Solutions -> Web Projects. I unchecked this setting and et voilà the next debug-session started as tabs in my already running browser-instance.
As I am not sure if this is a bug introduced with this Visual Studio version, this may change again in any next release. So this setting may be reverted in case of any unexpected behavior.
Update
Seems like version 15.8.5 still has this issue/behavior.

Related

Web Publish Activity window is not maintained when closing and reopening Visual Studio 2022

I recently applied an update to Visual Studio Community 2022 (64-bit).
Current Version is 17.3.4
We still use Web Deploy for some legacy asp.net sites and the Web Publish Activity window is very useful for switching between dev and production environments.
After a recent Visual Studio upgrade I noticed that the Web Publish Activity window was not visible, so I reopened it via View -> Other Windows... and it appeared as expected in the lower window, as a new tab along with Output and Error List.
But after closing my project and reopening it, the Web Publish Activity window is missing again. I tested other windows like PowerShell and Bookmark Window and they ARE maintained after closing and reopening VS.
I also tried saving a new window layout with the Web Publish Activity window open and then reapplying that layout after a VS restart but that had no affect.
It is very annoying to have to go though multiple levels of the View menu to reopen this window every time I open this project.
Does anyone have any advice on how to keep this window locked/pinned?
Is Microsoft trying to "encourage" me to stop using this window?
If there is another way to quickly change between publish profiles that would be acceptable as well, but I cannot find one.
Thank you.
This may be a bug with this particular window (the fact that it doesn't stay pinned after closing Visual Studio that is).
Perhaps as a decent workaround you can at least assign a keyboard shortcut to open this window:
Go to Options → Environment → Keyboard
Filter down to "View.WebPublishAcitvity" or find it in the list
Create a keyboard shortcut of your liking by typing it in the circled red box and then click the Assign button:
After doing that, you should be able to use that shortcut to open the window much faster at least.

Visual Studio 2019 - can't change profile settings, opens FolderProfile.pubxml instead

I have a problem with Visual Studio 2019.
From what I have seen in tutorials, during publishing an application, I should be able to change profile settings, by clicking a small pencil (I included a screenshot, it's a little pencil next to "false" and other settings.) However, every time i click it, it opens FolderProfile.pubxml file in Visual Studio instead! Is this indended behaviour, am I doing something completely wrong? How to change that? Screenshot
My problem fixed when I updated visual studio.
Also go to extensions and update all.
Now show UI options.

How to stop debug opening a new Chrome window instead of a tab? Visual Studio 2017.7

With Visual Studio / MVC, when clicking debug, it's always launched the local site as a new tab in my currently open Chrome window.
With the 2017.7 update, now it launches a new window every time.
Is there any way to change back to loading it into a tab? I don't like the "new Chrome window every time" behavior
Nevermind, just noticed a new answer in one of my previous questions covers this
How to stop browser closing automatically when you stop debugging on VS 2017

How to disable the new debug window in VS2017

I'm using Visual Studio 2017 RC and getting very frustrated with the new Chrome window that pops up when you click Debug.
Issues with the Debug Chrome Window:
Takes ages to start/"attach" website (I think it's attaching all the javascript debugging which I don't need because I use Chrome DevTools for that anyway)
Not dockable (as a tab) with other Chrome windows
Doesn't remember form history. If I'm testing out forms I can't autocomplete form data, so I have to type the whole lot out every time
Doesn't remember url history. If I'm testing a specific page on my site, I can't quickly select the url from Chrome url bar dropdown. Have to type the url in full
Extensions aren't enabled so I can't use my ruler or color picker extensions
Chrome window closes when debugging stops so I have to open up a new window to keep browsing the local site
Does anyone know how to disable this new Debug style window and go back to how it was in VS 2015?
I'm not sure if this came with the latest VS 2017 Update, but inside Debug -> Options you can disable it now.
Just uncheck the highlighted one:
For thoose, who have the 15.7 update and unchecking the JavaScript options doesn't do the trick, found a solution here:
https://blogs.msdn.microsoft.com/webdev/2016/11/21/client-side-debugging-of-asp-net-projects-in-google-chrome/
Tools > Options > Projects and Solutions > Web Projects, uncheck “Stop debugger when browser window is closed”
This is not an issue, rather a new feature in VS 2017. Previously we could only debug JS and TypeScript using IE in debug mode (of VS). But now they have introduced debugging JS and TS inside VS using Remote Debugging feature of Chrome. If you are running your application in debug mode (pressing F5) and Chrome is selected browser, Visual studio 2017 will try to open a remote debugging session with Chrome on a dedicated port. With remote debugging,
The browser is launched in plain mode, i.e. no extension and no history etc. Remote debuggin doesnt work with an existing instance of Chrome already running.
You always see this window for a while. At this point, VS is trying to attach the remote debugger to VS
To go back to VS 2015 experience of debugging, change the debugging target from Chrome to IIS Express.
This post describes this feature in detail. https://blogs.msdn.microsoft.com/webdev/2016/11/21/client-side-debugging-of-asp-net-projects-in-google-chrome/
A kind of quick work around is to press F5 and launch the debug
session and forget about the newly opened Chrome window. Go to your
normal Chrome instance and just open your site in new tab. You will
still be able to debug and do everything because IIS Express will
still be running your app at that port.
Update:
The answer given below by #Steveadoo is the right way going forward. The option shown in his screenshot controls how chrome is launched for debugging. Uncheck it if you want to stick to your regular Chrome instance.
Hope this helps.
For VS 2017, Go to Tools -> Options -> Projects and solutions-> web projects and uncheck the last option as shown in image.
Also you can refer here: https://www.johanbostrom.se/blog/how-to-disable-the-built-in-chrome-from-starting-when-debugging-in-visual-studio-2017
Here is the Microsoft blog about this new functionality, and how to revert.
https://blogs.msdn.microsoft.com/webdev/2016/11/21/client-side-debugging-of-asp-net-projects-in-google-chrome/
Here is the path I followed to disable:
Debug > Options > Debugging > General > (uncheck) Enable JavaScript debugging for ASP.Net (Chrome and IE).
In VS menu click:
Tools > Options > search for "browser projects" > untick the last option "Stop debugger when browser window is closed.
this will do the job.
Debug > Options > Debugging > General > (uncheck) Enable JavaScript debugging for ASP.Net (Chrome and IE).
Tools > Options > Projects and Solutions > Web Projects, uncheck “Stop debugger when browser window is closed”
works for me, visual studio professional 2017, v 15.7.3
I'm using Visual Studio 2017, and what worked for me is a combination of these two options:
Disable JavaScript debugging in Debug -> Options -> Debugging -> General Enable JavaScript debugging for ASP.Net.
Disable stop debugging when browser is closed in Debug -> Options -> Projects and Solutions -> Web Projects -> Stop debugger when browser windows is closed, close browser when debugging stops.
When I used only one of these two it did not work.
if you look to JavaScript case
For Enabling and Disabling JavaScript Debugging in VisualStudio is the same on all versions
Tools menu
Options...
Debugging -> General
Uncheck "Enable JavaScript debugging for ASP.NET"
In Visual Studio 2017:
If it prompts you again to turn JS debugger on again, choose another option (It will continue to prompt you if you have breakpoints in your script code):

How to stop browser closing automatically when you stop debugging on VS 2017

I'm trying out the new VS 2017 RC and wondering if anyone knows how to get the previous debugging behavior back
In VS 2015 it went like this:
Press start debugging
Website opens in new Chrome tab
Press stop debugging
Website is still open and the site is still running/active
Now in 2017:
Press start debugging
Website opens in new window that can't dock with any other Chrome windows/tabs
Press stop debugging
Website/Chrome window closes, can't continue using the site unless I manually go to the localhost window in Chrome
Is it possible in 2017 to switch back to the 2015 style? So the Chrome/Website window can dock with other Chrome windows/tabs, and it stays open after you stop debugging?
Additionally, I find the new Chrome window frustrating to use, as it seems not to have any history/content available. E.g I can't autocomplete forms or urls, which is very annoying when I'm trying to test a form
Visual Studio 2017 version 15.7 and higher & Visual Studio 2019 changed things again.
Disabling the following checkboxes will allow you to keep the browser open (doesn't close after stop debugging) and opens another tab (instead of another window):
Tools > Options > Debugging > General
Disable "Enable JavaScript debugging for ASP.NET (Chrome, Edge and IE)".
Tools > Options > Projects and Solutions > Web Projects
(Visual Studio 2017) Disable "Stop debugger when browser window is closed".
(Visual Studio 2019) Disable "Stop debugger when browser window is closed, close browser when debugging stops".
The reason for the change in behavior is due to VS 2017's support for debugging JavaScript/TypeScript running in Chrome. See announcement here https://blogs.msdn.microsoft.com/webdev/2016/11/21/client-side-debugging-of-asp-net-projects-in-google-chrome/
To return to the 2015 behavior where Chrome is not closed by the debugger, disable the IE/Chrome script debugger in Tools -> Options like so:
For those of you who updated to Visual Studio 2019, that config is now under
Tools > Options...
And then in the options dialog (see image below)
Projects and Solutions > Web Project :
Uncheck Stop debugger when broswer window is closed, close browser when debugging
I am writing this answer as I think the previous ones cover only half of the problem.
First thing you want is to get rid of this annoying 'run chrome as a new window and auto-close when stopped debugging'
Tools → Options → uncheck Enable JavaScript debugging for ASP.NET
After doing that when starting debugging chrome opens a new tab, after stopping the tab is not closed but refreshing website shows white screen
again in the Tools → Options
uncheck Enable Edit and Continue
Since now you have your old behaviour back.
If your project is .net core:
in Properties folder > launchSettings.json file set this config :
"launchBrowser": false,
Else in visual studio 2022 :
Tools > Options > Projects and Solutions > Web Projects
uncheck : Stop debugger when browser window is closed, close browser when debugging stops
Go to Tools -> Options and search for "Stop Debugger". Then select the node Web Projects under Projects and Solutions. Uncheck "Stop debugger when browser window is closed". Before this option your should apply #jerone's suggestion.
PS: This option can be used after VS version 15.7
There are two ways to do this:
Either Launch without debugging by pressing ctrl + f5 or
Launch with debugging (pressing f5) and then go to the Debug menu and press "Detach All"
Hope that helps.

Resources