title | ms.custom | ms.date | ms.topic | dev_langs | helpviewer_keywords | ms.assetid | author | ms.author | manager | ms.workload | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Create file associations (ClickOnce app) |
SEO-VS-2020 |
11/04/2016 |
how-to |
|
|
835230c8-3177-440f-85e3-e40f1d8b4f9d |
mikejo5000 |
mikejo |
jillfra |
|
[!INCLUDEndptecclick] 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 [!INCLUDEndptecclick] application is straightforward.
-
Create a [!INCLUDEndptecclick] application normally, or use your existing [!INCLUDEndptecclick] application.
-
Open the application manifest with a text or XML editor, such as Notepad.
-
Find the
assembly
element. For more information, see ClickOnce application manifest. -
As a child of the
assembly
element, add afileAssociation
element. ThefileAssociation
element 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
file
andfileAssociation
elements, see <fileAssociation> Element.
-
-
If you want to associate more than one file type with the application, add additional
fileAssociation
elements. Note that theprogid
attribute 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).