views:

254

answers:

2

This should be a duplicate question, but I haven't be able to dig up the answer. I want to add a task to the Vista Task Scheduler that launches my ClickOnce installed program. As I understand the .exe of the application is hidden? So I tried to enter the desktop shortcut as the item to start in the Action tab. But this does not work. I get an error message stating the shortcut was no valid win32 application.

What now?

+2  A: 

ClickOnce applications are stored in C:\Documents and Settings\*\Local Settings\Apps\2.0\ (on XP. I'm sure you can figure out where from this on Vista, or whatever you're using.). Furthermore, each deployment version is stored in a different place, making this a rather interesting problem.

The way I did auto-start on my ClickOnce application was that every time it starts up, it checks the autostart registry setting, if it exists, then it sets it to the location of the currently executing executable, to be sure that the most current version is being auto-started (it handled updates manually and restarted itself when it was done).

If this is going to be a regular scheduling, then you're going to have troubles. If it's a once-off, then perhaps searching through the app cache might yield results. If you want regular scheduling though, I think you're going to find it will be infinitely easier to use a different distribution mechanism.

Matthew Scharley
+1  A: 

One thing to note, though. If you want it to run as a ClickOnce application, i.e. pick up updates, you have to call the appref-ms file, not invoke the exe directly. Running the exe just runs it as a regular application, and it will never check for updates. If you're going to do that, you might as well just xcopy the application over and stick it in a folder and schedule it to run.

You might check this thread out about auto-starting a ClickOnce application.

http://news.softpedia.com/news/How-To-Add-an-Application-To-Startup-Using-The-Registry-43488.shtml

RobinDotNet