I have C# WinForm .NET 4.5 application. I set Project -> Properties -> Publish -> Options -> File Associations. This part seems to work because it sets icon that I selected and if I double click file with custom extension (in this case *.psi) it opens my application. But I am having hard time getting file name that was double clicked. Somehow my static void Main(string[] args) args are always empty. I use ClickOnce deployment method.
Can anyone help me with what I am missing to open custom file with my application.
static void Main(string[] args)
{
if(args.Length > 0)
{
MessageBox.Show(args[0]);
}else {
MessageBox.Show("args is empty!");
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
DevExpress.Skins.SkinManager.EnableFormSkins();
UserLookAndFeel.Default.SetSkinStyle(Properties.Settings.Default.ActiveSkinName);
Application.Run(new MainForm(args));
}