R – Autostart ClickOnce application in a silent mode

clickoncenetsilentstartup

I have an application that uses ClickOnce to deploy, and I have managed to get the application starting when a user logs in.

My issues are that I need the application to start up hidden (I don't want a user to have to minimize it until they require it – I want it to sit in the system tray). Prior to using ClickOnce I simply checked the arguments to see if "/silent" was passed in. There appears to be no way to do this in a ClickOnce application (you can check if a URI query string is passed in, but because this is run from a .appref-ms shortcut there appears to be no way to get the /silent argument)

How can I get the /silent argument, or how can I tell if the application has started as a result of the user logging on (rather than the user starting the application from a shortcut)?

It is important that whatever solution proposed doesn't require administrator permissions, but the language used isn't as important as I can probably port it to .NET.

Best Answer

I don't think there's a very clean way to do this since command arguments don't work, and you can't use query string arguments.

However, try deploying another small executable with your ClickOnce deployment. It would be responsible for setting a "startup" flag (in a configuration file, registry, whatever) and then launching your actual application. Your application would check the flag to determine if it should launch silently and then reset the flag. Then you would just have the small executable start with Windows rather than your main application.

Of course I didn't try any of this out.

Related Topic