Set default browser when debugging WPF?
Asked Answered
H

5

15

I'm using VWD Express 2008 to develop a WPF Browser Application. When I start debugging, it launches the XBAP in my default browser, which is Opera. Obviously, XBAPs don't work in Opera, so I have to repeatedly right-click on the document to open in IE.

Is there any way to change the settings for PresentationHost.exe so that it always opens with IE? A registry setting, perhaps?

Hilmahilt answered 10/7, 2009 at 5:8 Comment(0)
U
10

Setup the external program as Internet explorer path and the command line arguments as your path to xbap file within quotes, like shown below:

enter image description here

Unparalleled answered 1/10, 2012 at 1:44 Comment(0)
T
3

A simple and easy way to do this is to associate *.htm or *.html (don't remember exactly, try both) files with IE, and it will work for XBAP.

UPDATE:

Solution described above works for "Start external program option".

For "Start browser with URL" option you actually can set default browser in Visual Studio. I don't find how to set it through Tools -> Options, but you can achieve it by following steps:

  1. In your solution explorer find a file which meant to be viewed in browser (e.g. *.htm, *.svc)
  2. Right click on this item and choose "Browse With..."
  3. In the opened window you'll see a list box with installed browser and one of them will be marked as default.
  4. In the list box Choose "Internet Explorer" and click "Set as Default" (if there is no IE browser in the list just add it).
Tailor answered 13/4, 2010 at 15:3 Comment(0)
E
1

Set Default browser to IE for WPF:

Project preporties -> Debug tab properties...

  1. Remove "-debug" only, if there in Command line arguments:(under Start Options)
  2. Choose Start external program ( under Start Action) and give the path of "iexplore.exe" (EX: C:\Program Files\Internet Explorer\iexplore.exe )
Eblis answered 22/2, 2013 at 4:29 Comment(0)
A
0

XBAP does work in Opera (and I can make a screenshot to prove the point). Consider updating your Opera version and/or .NET (do you have SP1?).

Aurify answered 10/7, 2009 at 5:12 Comment(2)
I just updated Opera a couple of weeks ago to 9.64, so that's not it. Pretty sure I have the latest SPs for .NET. How did you get XBAPs to run inside of Opera?Hilmahilt
I must admit that I do not know what exactly did I do that made it work, but it works. One piece of the puzzle might be that I'm using the most recent Opera 10 alpha.Aurify
M
0

Check out this post on the msdn forums.

The workaround I found works OK, but requires that Firefox be your default browser:

In Firefox, open the menu Tools / Options / Downloads.

Then click on "View & edit actions" and change the action for XBAP applications to the Windows Presentation Host.

Now when I debug, Firefox receives the XBAP, but then it automatically pass it to the presentation host, which runs into IE. A bit cumbersome, because everytime a new tab gets opened in Firefox, but it's OK. It also works with F5, so you can debug.

Alternatively, you can start IE, navigate to the XBAP URL and then manually attach the debugger to the PresentationHost process (not to IE though).

Morbilli answered 10/7, 2009 at 5:14 Comment(1)
Your post gave me an idea... basically I did the equivalent in Opera, which is: Preferences -> Advanced -> Downloads select "application/x-ms-xbap" MIME type Edit -> select Open with other appication in textbox enter "C:\Program Files\Internet Explorer\iexplore.exe" check "Pass Web address directly to application" This automatically opens the XBAP in IE, but just like your solution, I'm left with a blank tab in Opera. It would be nice to see if there are any better solutions out there.Hilmahilt

© 2022 - 2024 — McMap. All rights reserved.