So I wrote a VB.net project in Visual studio. I have a scheduled task that is set to run the program every morning at 10AM.
- If I use windows explorer and double click the application, it runs fine.
- If I open task scheduler, open the task properties, and browse to the application, then choose run, the program fails, due to Runtime exceptions.
I know I have the path entered correctly, since I can debug the instance when it crashes from the task scheduler. VS2010 pulls up my source code…
Any Ideas?
I feel like I’ve tried everything..
Update
The exception is System.IO.FileNotFoundException, remember, it works fine when I double click the app. If attach a debugger to the process after it is executed from the task scheduler, I can then restart the debugger, and Voila!, The application runs fine.
When you create a task, under the “Edit Action” properties, there is a field “Start In (Optional)” It is not optional. It is critical this is populated with the path to the program you are executing. if it is not your scheduled task will fail… It seems redundant but it fixes the issue.
Thanks Microsoft.