visual-studio Visual Studio 打开默认浏览器而不是 Internet Explorer

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/79954/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 16:30:34  来源:igfitidea点击:

Visual Studio opens the default browser instead of Internet Explorer

visual-studiointernet-explorer

提问by Kevin Sheffield

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?

当我在 Visual Studio 中调试时,Firefox 会打开,这很烦人,因为 Internet Explorer 和 Visual Studio 具有连接,例如当您关闭启动调试打开的 Internet Explorer 浏览器时,Visual Studio 会停止调试。如何让 Visual Studio 打开 Internet Explorer 而不必将 Internet Explorer 设置为我的默认浏览器?

回答by Jon Limjap

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

Scott Guthrie 发表了一篇关于如何更改 Visual Studio 的默认浏览器的帖子:

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.

1) 右键单击​​解决方案资源管理器中的 .aspx 页面

2) 选择“浏览方式”上下文菜单选项

3) 在对话框中,您可以选择或添加浏览器。如果您希望 Firefox 出现在列表中,请单击“添加”并指向 firefox.exe 文件名

4) 单击“设为默认值”按钮,使其成为您在站点上运行任何页面时的默认浏览器。

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

然而,我不喜欢这样一个事实,即这并不像它应该的那样简单。

回答by Tim Santeford

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:

在 Visual Studio 2010 中,默认浏览器经常重置(几乎每次 IDE 设置更改时,甚至在重新启动 Visual Studio 后)。现在有一个 2010 的默认浏览器选择器扩展来帮助解决这个问题:

!!!Update!!!It appears that the WoVS Default Browser Switcher is no longer available for free according to @Cory. You might try Default Browser Changerinstead 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.

!!!更新!!!看来,WoVS默认浏览器切换不再免费提供,根据@Cory。您可以尝试使用Default Browser Changer,但我尚未对其进行测试。如果您已经拥有 WoVS 插件,我建议您将其备份,以便稍后安装。

The following solution may no longer work:

以下解决方案可能不再有效:

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

WoVS 默认浏览器切换器http: //visualstudiogallery.msdn.microsoft.com/en-us/bb424812-f742-41ef-974a-cdac607df921

WoVS Default Browser Switcher

WoVS 默认浏览器切换器

Edit:This works with ASP.NET MVCapplications as well.

编辑:这也适用于ASP.NET MVC应用程序。

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:

启动VS时会看到如下错误:

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

默认浏览器切换器测试版位已过期。请使用扩展管理器或访问 VS 库下载更新的位。

回答by Ani

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

对于MVC3,不必添加任何虚拟文件来设置某个浏览器。您所要做的就是:

  • "Show all files" for the project
  • go to bin folder
  • right click the only .xml file to find the "Browse With..." option
  • 项目的“显示所有文件”
  • 转到 bin 文件夹
  • 右键单击唯一的 .xml 文件以找到“浏览方式...”选项

setting MVC3 project default browser

设置MVC3项目默认浏览器

回答by tsimon

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

右键单击一个 aspx 文件并选择“浏览方式”。我认为有一个选项可以设置为默认值。

回答by 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.

如果您正在运行 MVC 3 应用程序 - 在您的解决方案资源管理器中单击显示所有文件图标,然后在 Global.asax 文件下应该有一个名为 YourProjectName.Publish.XML 的文件,右键单击它,然后单击“浏览方式”。 ..”并选择您喜欢的浏览器作为默认浏览器。

回答by jasonpenny

Also may be helpful for ASP.NET MVC:

也可能对 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…'

在 MVC 应用程序中,您必须右键单击 Default.aspx,这是该解决方案中唯一的“真实”网页。默认页面显示“浏览...”

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

http://avicesoft.wordpress.com/2008/08/04/...

回答by rp.

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

在解决方案资源管理器中,右键单击任何 ASPX 页面并选择“浏览方式”并选择 IE 作为默认值。

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

注意...可以使用相同的步骤将 Google Chrome 添加为浏览器选项,并可选择将其设置为默认浏览器。

回答by 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

如果您的项目中没有 .aspx(即它的 XBAP),但您仍然需要使用 IE 进行调试,请快速注意,只需在您的项目中添加一个 htm 页面并右键单击该页面以设置默认值。这是hacky,但它的工作原理:P

回答by Davut Gürbüz

You may debug by firefox also.

您也可以通过 Firefox 进行调试。

Follow these steps: Tool->Attach to processand select firefox.exeor 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.

请按照以下步骤操作:Tool->Attach to process并选择firefox.exe或您的默认浏览器。然后调试器将与此浏览器一起工作。但是当 Firefox 是 32 位而 VS2010 是 64 位时,我遇到了一些麻烦。

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因为firefox的进程id可能会改变,所以你会因为再次附加进程而烦恼。

回答by Bryan Legend

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

在 VS 2017 中,使用 Chrome 调试 ASP.NET 项目不会使用您的 Google 帐户登录。

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

要修复该问题,请转到工具 -> 选项 -> 调试 -> 常规并关闭为 ASP.NET(Chrome 和 IE)启用 JavaScript 调试设置。

https://msdnshared.blob.core.windows.net/media/2016/11/debugger-settings-1024x690.png

https://msdnshared.blob.core.windows.net/media/2016/11/debugger-settings-1024x690.png