Microsoft's ClickOnce deployment system offers an easy-to-use file association manager which is built into the Visual Studio deployment process. Developers can add up to 8 file associations which will automatically be associated with their application when the user runs the ClickOnce installer.
I'd like to take it one step further, though: I want to allow users to manually add or remove additional file associations after installation from within my application.
I have two motivations for accomplishing this:
Unlike traditional Windows applications, ClickOnce applications are not launched directly via their executable. Instead, they are launched via a special .appref-ms
shortcut which handles the ClickOnce magic behind the scenes (automatic updates, locating the executable files in an obfuscated directory in %LOCALAPPDATA%
, etc).
If a ClickOnce-deployed app is opened directly via its executable, automatic updates are disabled and ClickOnce-specific methods will no longer function. Because of this, traditional registry file associations are not possible for my use case.
The image below demonstrates Visual Studio 2010's built-in ClickOnce file association manager. This information is stored in the application's .manifest file and is added to the Windows registry upon installation.
I've done some digging through my registry and have identified several entries made by the ClickOnce installer to associate filetypes with the ClickOnce deployed application.
An example registry key for a ClickOnce filetype association I found in my registry:
rundll32.exe dfshim.dll, ShOpenVerbExtension {ae74407a-1faa-4fda-9056-b178562cf98f} %1
Where {ae74407a-1faa-4fda-9056-b178562cf98f}
is a GUID used in several other locations in the registry for the associated application.
My goal is to learn what information must be added to the registry (programmatically) to manually associate files with a ClickOnce deployed application.
Any help is appreciated!
You can figure out the registry keys to be added, using Windows Sysinternals Process Monitor (Previously known as RegMon).
Capture Events when you install your app using ClickOnce with default file associations. It will record all the registry operations (lots of them).
You would need to use some filters to easily identify the registry keys.