views:

1251

answers:

4

How can I make a Click-once deployed app run a startup?

The best option I found by searching was to set the Publisher on the app to Startup, so the Start menu shortcut would be placed in the Startup folder, but that seems like a huge hack and I would like there to be a Start menu icon people can find.

What options do I have?

+2  A: 

In terms of actually getting the application to launch at startup, having a link in the startup folder is your best bet. Or if not the startup folder then the startup reg key.

A way to work around not having the Icon in it's normal position is to have the application place a link to itself into the startup folder on Application startup. ClickOnce apps will run the first time they are installed. The application can use this startup to place a link in the Startup folder. Now the link will be in both places and you should be golden.

There is the issue though that now deleting the ClickOnce app will no longer actually delete it. ClickOnce will not track the manual link added and hence every time someone un-installs your app and reboots it will re-install. I would start considering that program to not be behaving well :(.

JaredPar
I would have thought that the clickonce sandbox would prevent you from touching either of those directories without a specific admin request?
Spence
A: 

You could add your app to the appropriate "Run" startup registry key at startup. Then even though you can't remove it when your app is deleted, it won't hurt anything and nobody will see the broken reference.

BRH
+3  A: 

All these tricks dont work on Vista unfortunately. Vista blocks these programs on startup for some reason.

As suggested by @thijs, you can easily bypass vista's "security" on this one. See blogpost on how to run clickonce apps on windows startup.

To stop malicious malware writers from doing stuff like running clickonce apps at startup without the user requesting it.
Spence
Good to know. Thanks.
Eric Haskins
You can easily bypass vista's "security" on this one, see my blogpost on how to run clickonce apps on windows startup: http://www.brokenwire.net/bw/Programming/116/run-clickonce-app-on-startup
thijs
@Spence Don't see how that makes any sense. Why ban just one specific type of application? Isn't any other malware equally harmful when started at logon?...
romkyns
Yes but Clickonce apps can be "installed" without administrator permissions in certain scenarios. So the sandbox that they run in is constrained to prevent malicious software on windows startup.
Spence
A: 

Please see dipeshavlani.blogspot.com for solution to this problem.