C# – How to find out whether the .Net application was launched using a shortcut

cclickoncenet

Is it possible to find out whether your current .Net app has been launched using a shortcut or a Clickonce application reference (*.appref-ms) file? If so, how?

Some background: I am running into an issue using Microsoft Clickonce in which I cannot pass command line arguments to the application. It seems that this is the way the technology works by design. I was exploring different ways of passing this parameter; one of them was to have a set of different Clickonce Start Menu shortcuts.

Best Answer

Try testing out the ApplicationDeployment.IsNetworkDeployed property. I know this will be true if it is a ClickOnce app but I'm not sure if it will be false in your situation.