1

An interesting requirement that came up for one of the applications I'm working on. We support both ClickOnce deployment for the majority of customers and traditional deployment with an MSI (WiX) package for those customers that require more control over the install process.

However, regardless of how the application is installed, when a user clicks the 'Launch' button on our website, I need it to launch the application. If it's already been installed via the MSI package for the current user, it should launch the currently installed copy; otherwise, it should install/update/run the ClickOnce package. I suppose I could make the ClickOnce version launch the MSI-installed version if it's present, then quickly close. This question gives me hope that it might be possible by simply making both applications have the same GUID, but I'm not sure how to do that, or if it's even a good idea.

It's trivial to make a link that launches the ClickOnce application:

<a href="/path/to/myapp.application">Launch</a>

And it's not too difficult to make a custom protocol handler that gets registered with the MSI:

<a href="myapp:launch">Launch</a>

However it doesn't seem possible to make the ClickOnce application be able to handle this new protocol, and even if I solve that problem, this won't work for new customers that don't have either installed.

Is there a relatively simple way to make a single web link that will launch an MSI-installed application or a ClickOnce application?

Community
  • 1
  • 1
p.s.w.g
  • 146,324
  • 30
  • 291
  • 331
  • It seems unlikely to me you can launch an application on the user's machine from a web browser. Most of them have specific safeguards to prevent that kind of thing! You'd need to get out of the sandbox, and IE's low integrity level also. You'd probably need to install an app that the user runs that can embed a browser window and activate apps on the local machine. And it's got nothing to do with guids - ClickOnce and MSI are completely different and unrelated. – PhilDW Sep 23 '15 at 17:42
  • @PhilDW there are a few ways you can launch an application from a web browser, although generally they require additional confirmation or other steps from the user, of course. I've added a few more thoughts on the subject. – p.s.w.g Sep 23 '15 at 18:27
  • I'd dump the click once story personally. – Christopher Painter Sep 23 '15 at 22:46
  • @ChristopherPainter Unfortunately, we're dealing with a little bit of legacy here. This application replaces an older, 3rd party tool that was deployed with ClickOnce. Customers knew it and sorta liked it. The new application could give a lot more power and control to the customers with IT departments savvy enough to know how to install & configure it on their networks, but most of the end users will still expect a 'Click Here' button. – p.s.w.g Sep 23 '15 at 23:01

2 Answers2

0

I've used this technique from a Silverlight application to invoke a local application. We had to sign the XAP and get it trusted for it to work though. I'm not sure how it would work from a normal HTML page.

Registering an Application to a URI Scheme

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • Yeah, I considered that, but it doesn't seem to work with ClickOnce, or with users that don't have either version installed yet. I might be able to use Silverlight (or similar) to inspect the user's system to see if the MSI version is installed, and if not change the link to point to the ClickOnce application. – p.s.w.g Sep 23 '15 at 23:01
0

I think you're going about it backwards. If you want to invoke the ClickOnce app (check for updates and run the app), you can do a process.start(ieexplore.exe, "http://myserver.mydomain.com/myapplication/whatever/myapp.application") (using the URL to the actual ClickOnce app). Rather than having the ClickOnce app invoke the msi, can you do it the other way around and have the msi invoke the ClickOnce app? Or write something to check which one to run/install and invoke it?