Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you set up a file association with a click-once application?

I have a click-once application.

I have an associated file that I store the application's data in.

When a user clicks on one of these files I want it to open the click-once app and load the file.

I can set up the file association in the publish, the icon and name is correctly set. Clicking on the file opens the application, but the application doesn't seem to be passed the path to the file - the command arguments are empty.

How do I get it so that the path to the file is passed to the application?

like image 272
Keith Avatar asked Feb 06 '09 16:02

Keith


People also ask

What does it mean to register file associations?

File associations are registry settings that tell Windows what application to use to open files of a certain type. For example, Windows typically launches Notepad.exe when a text (. txt) file is opened.

What is a one click application?

What is a ClickOnce application? A ClickOnce application is any Windows Presentation Foundation (. xbap), Windows Forms (.exe), console application (.exe), or Office solution (. dll) published using ClickOnce technology.


1 Answers

When using Click Once, arguments are not passed in on the command line, they are passed in through the Click Once deployment system:

AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData

For example, in your Program.cs file:

foreach (string commandLineFile in AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData)
{
    MessageBox.Show( string.Format("Command Line File: {0}", commandLineFile) );
}

Hope this helps.

like image 77
Rob Avatar answered Sep 21 '22 15:09

Rob