Alina Anjum
Alina Anjum

Reputation: 1230

How to Schedule Console Application C#

I have created a Console Application where I've added Microsoft.AnalysisServices dll. I want this App to be Scheduled for every 30 minutes.

I've Published the Application but when I give setup.exe path in Windows Task Scheduler, the task not runs

When I give the applicationname.exe path from the bin/Debug Folder, the application runs

reference: https://www.c-sharpcorner.com/UploadFile/manas1/console-application-using-windows-scheduler/

but I don't want to carry the project folder to the Production server, I need a single exe/setup file

I have also tried copying application.exe file from bin folder on desktop but it throws exception 'cannot find Microsoft.AnalysisServices', here is the Screen shot:

enter image description here

Please Help

Upvotes: 0

Views: 2160

Answers (2)

Filburt
Filburt

Reputation: 18081

For a (simple) console application, the easiest solution is to use what Microsoft propagated right from the start of .Net: "xcopy deployment".

Depending on your build target (Debug or Release) take everything from the [project dir]\bin\Debug or [project dir]\bin\Release and copy it to a application folder of your choice.

In your Scheduled Task, reference the executable in this application folder.

You can streamline your deployment by adding an automated copy task as a Post-Build task to your project configuration.

Upvotes: 0

hyvte
hyvte

Reputation: 183

You need to copy the whole output folder (publish artifact). You can omit things like the pdb files or xml documentations... You can also use tools like ILMerge to merge dependencies like the Analysis dll into one file, if you really need to.

Upvotes: 0

Related Questions