Quantcast
Channel: Scott Hanselman's Blog
Viewing all articles
Browse latest Browse all 1148

Extending the Visual Studio 11 Web Browser Chooser and Browse With Menu to include Developer Profiles

$
0
0

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).

Browser Switcher built into the toolbar

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:

Browse With is only visible when right-clicking on an ASPX file

That brings you to the list of browsers in the Browse With dialog:

All your browsers listed 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.

Adding a Firefox Dev Profile with "firefox.exe -p dev"

Here's my updated Browse With using the new Firefox dev profile. You could do with this Chrome also if you like.

Browse With showing my new Firefox Dev Profile

Now my browser chooser menu in the toolbar is updated with the my new browser. You can put whatever you like in that menu.

Menu in VS dropped down showing my new Firefox Dev Profile

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.

MOCKUP - Browse With Proposal with added menu - photoshop

This is just a Paint.NET but you get the idea. Thoughts?



© 2012 Scott Hanselman. All rights reserved.

Viewing all articles
Browse latest Browse all 1148

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>