There is a program file in the form:

[project] type=MyApp 1.0 project directory=D:\Папка проекта Еще какие-то значения. 

When you open the file inside the program (File-> Open project) everything works fine. But there was a need to open this file with a double click. Using ClickOne, I created a file of associations.

Opening a project trying to do so:

 private void MainForm_Load(object sender, EventArgs e) { string[] args = Environment.GetCommandLineArgs(); if (args.Length >= 2) { MessageBox.Show("Открыт проект! УРА!"); OpenProject(args[1]); } } 

In Program.cs it is stated that the arguments are accepted:

 public static void Main(string[] args) 

How to solve this problem?

    1 answer 1

    When registering with ClickOnce, the arguments do not come to the command line, but in AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData :

     foreach (string arg in AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData) MessageBox.Show(arg);