Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Add a ClickOnce program to the Vista TaskScheduler?

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?

like image 954
Dabblernl Avatar asked Aug 15 '09 11:08

Dabblernl


3 Answers

In Windows 7, I found this solution seems to work fine...

Scheduler action: "cmd.exe" with parameters "/c path_to_prgm.appref-ms". I would think this would work in Vista or XP as well. The cmd shell knows how to handle appref-ms files, but the task scheduler only knows how to run executable files.

like image 99
Ken Haley Avatar answered Nov 16 '22 23:11

Ken Haley


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

like image 26
RobinDotNet Avatar answered Nov 17 '22 00:11

RobinDotNet


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.

like image 20
Matthew Scharley Avatar answered Nov 16 '22 23:11

Matthew Scharley