ChatGPT解决这个技术问题 Extra ChatGPT

Visual Studio opens the default browser instead of Internet Explorer

When I debug in Visual Studio, Firefox opens and that is annoying because of the hookups that Internet Explorer and Visual Studio have, such as when you close the Internet Explorer browser that starting debug opened, Visual Studio stops debugging. How can I get Visual Studio to open Internet Explorer instead without having to set Internet Explorer as my default browser?


J
Jon Limjap

Scott Guthrie has made a post on how to change Visual Studio's default browser:

1) Right click on a .aspx page in your solution explorer 2) Select the "browse with" context menu option 3) In the dialog you can select or add a browser. If you want Firefox in the list, click "add" and point to the firefox.exe filename 4) Click the "Set as Default" button to make this the default browser when you run any page on the site.

I however dislike the fact that this isn't as straightforward as it should be.


This option is not available with MVC projects, for whatever reason
It is available for MVC projects, but you need to find the Default.aspx file for the project.
MVC2+ doesnt use a .aspx landing page
For MVC2+ I just add a .htm file, usually named Starter.htm and the upper solution works fine. I usually also just add it to the solution instead of a project. It makes more sense that way for especially if I have a multi-web-project solution. Oh and you don't have to worry about it being deployed with your source using Web Deploy VS2010 feature.
Note this is apparently built into VS 11 - blogs.msdn.com/b/webdevtools/archive/2012/03/01/…
C
Community

In Visual Studio 2010 the default browser gets reset often (just about every time an IDE setting is changed or even after restarting Visual Studio). There is now a default browser selector extension for 2010 to help combat this:

!!!Update!!! It appears that the WoVS Default Browser Switcher is no longer available for free according to @Cory. You might try Default Browser Changer instead but I have not tested it. If you already have the WoVS plugin I would recommend backing it up so that you can install it later.

The following solution may no longer work:

WoVS Default Browser Switcher: http://visualstudiogallery.msdn.microsoft.com/en-us/bb424812-f742-41ef-974a-cdac607df921

https://i.stack.imgur.com/EJESt.png

Edit: This works with ASP.NET MVC applications as well.

Note: One negative side effect of installing this extension is that it seems to nag to be updated about once a month. This has caused some to uninstall it because, to them, its more bothersome then the problem it fixes. Regardless it is easily updated through the extension manager and I still find it very useful.

You will see the following error when starting VS:

The Default Browser Switcher beta bits have expired. Please use the Extension Manager or visit the VS Gallery to download updated bits.


This is a better approach. ASPX may not necessarily be part of an ASP.NET MVC 3 application because you can choose a razor view engine.
This is definitely the best option for VS2010.
Unfortunately it seems this still doesn't help. There's a bug in VS2010, and unbelievably one that Microsoft has said won't be fixed until next VS: connect.microsoft.com/VisualStudio/feedback/details/568469/…
@Nicholas It does work and forces VS to stay on the selected browser regardless of the reset feature/bug. I would install this add-in even if there was no bug. I develop and test on 3 different browsers and this addin makes that really easy.
@Tim Here's what I mean-- if you launch a website, it always launches in IE first (even with the extension installed). Then the icons are disabled in the extension (this is a bug in their extension), so you can't choose a different browser. You have to use "Browse With" to launch the website with a different browser, then the extension's icons are enabled again.... Anyway, my point is that the extension does not correct the bug or really make it easier to work with. Microsoft needs to deploy a fix.
A
Ani

For MVC3 you don't have to add any dummy files to set a certain browser. All you have to do is:

"Show all files" for the project

go to bin folder

right click the only .xml file to find the "Browse With..." option

https://i.stack.imgur.com/dWpO3.png


What a terrible user interface. Thanks for this hack to get around it. It still seems necessary with MVC6 and Visual Studio 2017.
t
tsimon

Right-click on an aspx file and choose 'browse with'. I think there's an option there to set as default.


j
jasonpenny

Also may be helpful for ASP.NET MVC:

In an MVC app, you have to right-click on Default.aspx, which is the only ‘real’ web page in that solution. The default page displays ‘Browse with…’

From http://avaricesoft.wordpress.com/2008/08/04/...


Thanks for that. Everytime I patch VS it resets the default browser back to IE. It was driving me nuts opening a webforms project just so I could change it back to Firefox.
In MVC 2 Default.aspx no longer exists. in 2010 you have to create a basic webform page, set the default (since it doesnt hold from project to project). You can then remove the excess webform
M
Misho

If you're running an MVC 3 application - in your solution explorer click the show all files icon and then under the Global.asax file there should be a file called YourProjectName.Publish.XML right-click it and then click "Browse With..." and select your favorite browser as the default.


r
rp.

In the Solution Explorer, right-click any ASPX page and select "Browse With" and select IE as the default.

Note... the same steps can be used to add Google Chrome as a browser option and to optionally set it as the default browser.


G
Geoff

Quick note if you don't have an .aspx in your project (i.e. its XBAP) but you still need to debug using IE, just add a htm page to your project and right click on that to set the default. It's hacky, but it works :P


b
brigadir

You may debug by firefox also.

Follow these steps: Tool->Attach to process and select firefox.exe or your default browser. Then debugger will work with this browser. But I had some trouble when firefox is 32 bit and and VS2010 is 64 bit.

Anyway right click the current document, browse with --> than choose your browser, than set it as default. This way is better. B'cause firefox's process id may change, so you will be annoyed for attaching the process again.


B
Bryan Legend

With VS 2017, debugging ASP.NET project with Chrome doesn't sign you in with your Google account.

To fix that go to Tools -> Options -> Debugging -> General and turn off the setting Enable JavaScript Debugging for ASP.NET (Chrome and IE).

https://i.stack.imgur.com/WOXe1.png


G
Giri

In visual studio 2013, this can be done as follows:

1) Ensure you have selected a start up project from your solution explore window 2) This brings a drop down to the left of the debug drop down. You can choose browser from this new drop down.

Key is there should be a project selected as start up


u
user5087270

You mentioned Visual Studio. This is for Visual Studio 2013. In the "Menu and Tools" in the second line , right below Debug you have a dropdown box giving you the list / option of "Emulators" .Your IE should be in the option , select that and you are good to go. Easy way .


C
CPHPython

Your project might not have aspx files since it might be another kind of web project.

However, if it has a ClientApp folder:

go to the standard view of the Solution Explorer (Ctrl+Alt+L) where you can find your-project name solution (click on the folders icon at the top to be sure (saying "Solutions and Folders")) right-click on the ClientApp folder itself Browse with... will show up near the top (near View in Browser option), click on it and the browsers dialog shows up click on your preferred browser click on Set as Default click on Browse to confirm (this will open the browser you just chose on that folder)


T
The iOSDev

Another way is to do the following in Visual Studio:

Select Debug Options and Settings Expand Environment Select Web Browser Click the 'Internet Explorer Options' button Select the 'Programs' tab Select 'Make Default' button for Internet Explorer


You are just making internet explorer as your system's default browser. However I think question is "How can you run your site in Internet Explorer even if default browser is Chrome or Firefox?"
Why so much steps through VS to reach Internet Options, just open IE see tools or directly search in Start :-)