Showing posts with label Schedule Task. Show all posts
Showing posts with label Schedule Task. Show all posts

Tuesday, April 9, 2019

how to setup a schedule task for DotNet Core Console App?

When we publish the dotnet core project either from publish command in visual studio, or use the command line dotnet publish -c Release -r win10-x64 in CMD window.

after we execute the publish command. we can have the following message from the Visual Studio Output Windows

1>------ Publish started: Project: ConsoleAppEncryptDecrypt, Configuration: Release Any CPU ------
1>ConsoleAppEncryptDecrypt -> C:\Users\ddeng\Source\Repos\ConsoleAppEncryptDecrypt\ConsoleAppEncryptDecrypt\bin\Release\netcoreapp2.1\ConsoleAppEncryptDecrypt.dll
1>ConsoleAppEncryptDecrypt -> C:\Users\ddeng\Source\Repos\ConsoleAppEncryptDecrypt\ConsoleAppEncryptDecrypt\bin\Release\netcoreapp2.1\publish\
1>ConsoleAppEncryptDecrypt was published successfully to bin\Release\netcoreapp2.1\publish\
========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Publish: 1 succeeded, 0 failed, 0 skipped ==========

and we can see the compile output in this folder




when we schedule a task with action from this folder. we can use both paths

ConsoleAppEncryptDecrypt\bin\Release\netcoreapp2.1

ConsoleAppEncryptDecrypt\bin\Release\netcoreapp2.1\publish

the schedule task can run succesfully without an error.

However when we move the production server,

if we use this path  ConsoleAppEncryptDecrypt\bin\Release\netcoreapp2.1, the schedule task completed with an error code  3762504530.

the root cause of this issue is that the hosting server do not have the same environment as my local desktop. I have to use the publish folder (ConsoleAppEncryptDecrypt\bin\Release\netcoreapp2.1\publish) which will copy all necessary DLL to folder, in order to run the dotnet core Console app.

Wednesday, May 11, 2016

How to set the specific duration time for schedule task

you might be confused by the dropdown list on the For a durant of selection in the trigger window on the schedule task configuration.

we think that we only allow to select from the drop down list to make our choice.





In my case, I need to configure the schedule task to run on sunday from 12:00 AM unitl 8 PM at night. which is 20 hours in total. none of the item meet my criteria in the drop down.

the trick is to select either 12 hours from the dropdown list, then put a focus o the dropdown list control, then change 12 to 20, now the schedule task will be execute for 20 hours on every Sunday.