Registering custom URL schemes with ClickOnce installations

1k Views Asked by At

Similar to creating file associations during ClickOnce installations, is it possible to register custom URL schemes (e.g. "my-app:")?

I couldn't find any information about registering custom URL schemes in the ClickOnce Application Manifest documentation, so I fear that it's not possible to do that with with ClickOnce.

Maybe anyone has some kind of workaround or some different idea how to circumvent this limitation?

(Of course I could modify the registry on first start of my application, but then, when uninstalling the app via the ClickOnce uninstaller the registry keys I added manually wouldn't get removed.)

Thanks for a hint

1

There are 1 best solutions below

1
On

I found this workaround for adding and removing custom registry keys for ClickOnce installations:

http://www.codeproject.com/Articles/506162/ClickOnce-application-autostart-and-clean-uninstal

It basically works as follows:

Installation:

  1. ClickOnce installs your application
  2. Your application starts the first time and writes the required registry keys (e.g. for registering a custom URL scheme)
  3. Your application changes the uninstaller from the default ClickOnce uninstaller to your custom uninstaller.

Deinstallation:

  1. When a user wants to uninstall your app, your custom uninstaller is first started instead of the default ClickOnce uninstaller.
  2. Your custom uninstaller removes the custom registry keys.
  3. Your custom uninstaller finally starts the ClickOnce uninstaller which removes the rest of your application.

Caution: I observed problems (Windows complaining about an incomplete (de)installation) if the custom uninstaller contains certain typical "uninstaller keywords" (e.g. if the filename is "uninstall.exe"). See Windows Installer Detection: What's the full list of keywords?