Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute .Net Core 2.0 Console App using Windows Task Scheduler?

I have one Console App which is created using asp.net Core 2.0 in VS2017. Now I want to run this application on particular time period repeatedly (like service). So I have tried this using Windows Task Scheduler but when we create task using Task Scheduler it ask for .exe file of Console app. (please check below pic) enter image description here

But as you can see that When we create Console App using .Net Core 2.0 there will no .exe file under bin/debug folder. enter image description here Anyone have idea that how to schedule a .net Core 2.0 console app using Windows Task Scheduler ? Any suggestions will be highly appreciated !

Thanks,

like image 921
prog1011 Avatar asked Oct 23 '18 10:10

prog1011


People also ask

How do I run a console application in Task Scheduler?

Create a Task using Task SchedulerIn General tab, provide task name and description. In Trigger tab, create new and provide task schedule date, time, and day. In Actions tab, click New and give Action step and Browse console application executable file and click OK. Right click on created task and Run.

How do I run Task Scheduler?

Run it via the Run dialog window.Press the ⊞ Win + R keyboard keys at the same time. Type taskschd. msc . Hit the ↵ Enter key or click OK.


1 Answers

Just call dotnet and pass in dll you wish to run as argument. You can either specify the full path in the argument or set the path where your dll resides in the "Start in" field. You should use the published dll and NOT the development dll that gets created in the project's bin folder.

Task Scheduler Start DLL

like image 78
Xeevis Avatar answered Sep 30 '22 17:09

Xeevis