Extending the Visual Studio 11 Web Browser Chooser and Browse With Menu to include Developer Profiles
I talked about some new features that have snuck made their way into the free version of Visual Studio for Web. One of the more useful ones is the Browser Chooser that allows you to quickly launch debug sessions with different browsers from within VS. I've actually been pushing on this for about 18 months, and even blogged about it in August of 2010 in "how to change the default browser in Visual Studio programmatically with PowerShell and possibly poke yourself in the eye."
In Visual Studio 11 Beta you get a nice dropdown with all the browsers (plus the new Page Inspector).
However, I got a good comment from blog reader Abhijit who said:
The browser is a welcome addition (though past versions of VS do something similar). I'd like to make one suggestion though.
I use multiple Firefox and Google Chrome profiles. One for regular browsing and another for web development/debugging.
For ex: To launch a profile named 'dev' in Firefox, you'd use
firefox -p dev --no-remote in the shortcut/command line
This ensures that I don't mess up my history/profile/cookies etc with my development activities. However, the feature you've described launches the browser with no command line parameters.
So, is there a way I can add/update/customize the parameters used to launch the different browsers? And if not, is too late to suggest this as a feature request for VS11?
This is a not only a great tip, but a very useful bug/feature request. The tip is to use different profiles for when developing so you aren't accidentally combining your history and cookies for development with your personal stuff.
The feature is interesting because he wants to know how to customize the Browser Chooser. Digging into it, it turns out that it's totally possible but totally not discoverable. That means there's an opportunity to make this feature WAY WAY more useful.
First, here's the way to change it today on the Beta. Then I'll suggest a possible change to the feature to make it easier.
That list is initially auto-populated with the browsers we find on your system. You can add to the list with the "Browse With..." menu that you get when you right click on an .ASPX file in Visual Studio. Ah! But there's where the trouble starts. You can currently only see that menu when you right click on an ASPX page. This is great for Web Forms folks, but if you don't have an .ASPX file in your project then you're out of luck.
So, for now, add an ASPX file (you can delete it later) and right click:
That brings you to the list of browsers in the Browse With dialog:
At this point you can add your dev profile browser. (It would be nice if you could edit also, but you can't today.) Here I'm adding Firefox with a "dev" profile. Note that I'm naming it differently from existing browsers.
Here's my updated Browse With using the new Firefox dev profile. You could do with this Chrome also if you like.
Now my browser chooser menu in the toolbar is updated with the my new browser. You can put whatever you like in that menu.
Ok that's today with the Visual Studio 11 Beta. Here's a Paint.NET proposal of what I'd like to see. It'd be nice for the "Browse With..." to appear inline in the drop down menu. Having in the Right Click menu is too confusing.
This is just a Paint.NET but you get the idea. Thoughts?
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
I've been messing with it over the last couple of days and have only found how to select multiple browsers in the Browse With dialog. That's OK, but would love it to be a single keyboard shortcut.
START "" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" %1
START "" C:\%HOMEPATH%\AppData\Local\Google\Chrome\Application\chrome.exe %1
START "" "C:\Program Files (x86)\Internet Explorer\iexplore.exe" %1
And yes, Mike, I needed this because I am a designer/front-end dev. ;)
A minor annoyance since the Browse With... option has been available on the context menu in the Solution Explorer has been that you have to click the Browse button to get your settings in the dialog to stick. If you click Cancel, any browsers or default setting gets discarded (as it should be). But that means you always have to browse (read: run without debugging) with the new browser settings to get them to stick, then you can close the page and return to VS to start debugging.
Since the use case for the new browser drop-down is to debug, not browse, it would be nice to have an OK button on the dialog in order to add your browser(s), close the dialog, then immediately choose the browser with which you want to debug the web app.
Also, it seems that a simple addition like an OK button to the existing dialog, and just adding a menu option to access the existing dialog from the new browser drop-down in VS11, would be more likely to get implemented than a new "Add Browsers..." or "Browsers..." option, since the Browse With dialog has existed for some time, and would continue to work for both the browser drop-down and the Solution Explorer use cases.
Can anyone confirm similar behavior? Ideally I would like Firefox to close the Dev window after I stop debugging similar to IE.
Comments are closed.