Skip to content
February 27, 2009 / kiranpatils

Add More than one file Associations to a ClickOnce Application

Challenge:

One of my friend has one windows application and when he publish it using Clickonce it should be mapped with his custom file extension. For example “.JPG” and “.PNG” files should be mapped with his application called “MyPaint.exe”.

We found it that how to do it for one extension as shown in great post :

http://blogs.msdn.com/mwade/archive/2008/01/30/how-to-add-file-associations-to-a-clickonce-application.aspx

But no information provided here for how to do it for multiple file extension..hooh it took us half of the day to do it..Here is the way…

Solution:

1. Follow the steps given in Above post. Test it for one extension if it works for it then go to step 2.

[NOTE: you can open app.manifest under properties->App.manifest.dll double click it.] It will open .manifest in XML editor.

2.Here for one extension code we have added is as shown below:

<fileAssociation xmlns=”urn:schemas-microsoft-com:clickonce.v1″

extension=”.JPG”

description=”My PAINT”

progid=”16E5861B-EAC0-45d4-A53D-9D5962A63780″

defaultIcon=”myPaint.ico”

/>

3. NOW for adding one more extension here is the way:

<fileAssociation xmlns=”urn:schemas-microsoft-com:clickonce.v1″

extension=”.JPG

description=”My PAINT”

progid=”16E5861B-EAC0-45d4-A53D-9D5962A63780

defaultIcon=”myPaint.ico”

/>

<fileAssociation xmlns=”urn:schemas-microsoft-com:clickonce.v1″

extension=”.PNG

description=”My PAINT”

progid=”2601E048-C585-4bcf-8673-3A29C51D69B4

defaultIcon=”myPaint.ico”

/>

NOTE: Your both Program ID should be different!!

That’s it.

Hope it helps you kick off your project on its Release date:)

If it helped you say Thank to My friend who has introduced a nice problem to me..

Link which has given us a Kick : http://msdn.microsoft.com/en-us/library/bb892924.aspx

Sample code can be downloaded from here

Leave a comment