I have a clickonce application and I set up several file handlers for this application (for this example, I want to process files with the extensions .aaa or .bbb ).
If I select one file with one of these extensions, my application starts as expected, everything is fine. But if I select several files and open them (either by pressing Enter , or by right-clicking and choosing "Open"), several instances of my application are launched - one instance per selected file.
This is not the behavior that I expected, I want only one instance to start with several file entries in AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData . Can this be achieved, or is my expectation wrong?
Edit:
Just to clarify: we followed a single example, as mentioned in @Matthias, the first instance to run creates a named server pipe. Subsequent instances then start, find that they are secondary, report their command line arguments (file name) through the master instance through the named pipe, and then shut down. The main instance receives the file name through the named pipe and performs its action (launches the file import wizard).
The problem occurs when the user selects several files (i.e. 5 files), then chooses to open these files in the application. Instead of getting one additional instance starting with 5 file names included in the command line, I get 5 secondary instances of the application launch, each of which has one file name on the command line. Then each of them creates a client with the name pipe and passes that file name to the main instance - so that the server with the name pipe receives 5 separate messages.
The following thoughts:
after talking about it, it seems to me that maybe this is just how file handlers work, maybe itβs not related to clickonce. Maybe the solution for the server named pipe is suspended after receiving each message and trying to send messages to the queue before they act?
source share