How to: Create File Associations For a ClickOnce Application
This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, use the version selector at the top left. We recommend upgrading to Visual Studio 2019. Download it here
ClickOnce applications can be associated with one or more file name extensions, so that the application will be started automatically when the user opens a file of those types. Adding file name extension support to a ClickOnce application is straightforward.
To create file associations for a ClickOnce application
Create a ClickOnce application normally, or use your existing ClickOnce application.
Open the application manifest with a text or XML editor, such as Notepad.
assemblyelement. For more information, see ClickOnce Application Manifest.
As a child of the
assemblyelement, add a
fileAssociationelement has four attributes:
extension: The file name extension you want to associate with the application.
description: A description of the file type, which will appear in the Windows shell.
progid: A string uniquely identifying the file type, to mark it in the registry.
defaultIcon: An icon to use for this file type. The icon must be added as a file resource in the application manifest. For more information, see How to: Include a Data File in a ClickOnce Application.
For an example of the
fileAssociationelements, see <fileAssociation> Element.
If you want to associate more than one file type with the application, add additional
fileAssociationelements. Note that the
progidattribute should be different for each.
Once you have finished with the application manifest, re-sign the manifest. You can do this from the command line by using Mage.exe.
mage -Sign WindowsFormsApp1.exe.manifest -CertFile mycert.pfx
For more information, see Mage.exe (Manifest Generation and Editing Tool)