Makiwa

Stuart Campbell’s occasional musings about software development, etc.

Setting default browser in Visual Studio

When I switched to Firefox 3.0 as my default browser, VS started launching Firefox for debugging. But for some crazy reason I wanted to keep IE as the debug browser.

Usually this wouldn’t be too difficult, except that I’m using ASP.NET MVC, and for some reason the normal method isn’t available.

The normal method is to select an ASPX file and choose to Browse With…

Choose Browse With... on an ASPX

VS then launches a dialog allowing you to select your default browser.

Browse With dialog

However, if you’re in an ASP.NET MVC project (Preview 3 at the time of writing), the “Browse With…” option isn’t there. One solution is to open a non-MVC project and do as above.

Another solution is to go directly to the file where VS stores this setting: “browsers.xml”. The file is in your user profile, mine was:

C:\Users\Stuart\AppData\Local\Microsoft\VisualStudio\9.0\browsers.xml

Open the file in Visual Studio and then press Ctrl-K, Ctrl+D to format the document so that it is readable. Find the browser you want and set the <IsDefault> tag to True. Et voilà! Job done.

<?xml version="1.0"?>
<BrowserInfo>
  <Browser>
    <Name>Internet Explorer</Name>
    <Path>"C:\Program Files\Internet Explorer\iexplore.exe"</Path>
    <Resolution>0</Resolution>
    <IsDefault>True</IsDefault>
    <DDE>
      <Service>IExplore</Service>
      <TopicOpenURL>WWW_OpenURL</TopicOpenURL>
      <ItemOpenURL>"%s",,0xffffffff,3,,,,</ItemOpenURL>
      <TopicActivate>WWW_Activate</TopicActivate>
      <ItemActivate>0xffffffff,0</ItemActivate>
    </DDE>
  </Browser>
  <Browser>
    <Name>Firefox</Name>
    <Path>"C:\Program Files\Mozilla Firefox\firefox.exe"</Path>
    <Resolution>0</Resolution>
    <IsDefault>False</IsDefault>
  </Browser>
  <InternalBrowser>
    <Resolution>0</Resolution>
    <IsDefault>False</IsDefault>
  </InternalBrowser>
</BrowserInfo>


Tagged as + Categorized as Development

Leave a Reply