views:

48

answers:

3

Hi

I have to send a weekly email to subscribers. The content of this email comes from a database. I understand I have to set up a scheduled task on the server (I have to ask for this as I work remotely and don't have admin rights to do it). I did this in the past, where the email is sent by a .net page that gets called by the scheduled task. However I've read this is not the best way to do it, and that I should create an executable that runs every time it is called. How do I create an executable in .net, VisualStudio 2008? Could you explain? Many thanks!

+1  A: 

Just build a console application - they are executable.

(You could even build a WinForms app, but as you don't need to show a GUI this seems a bit pointless.)

Jon Skeet
+3  A: 

You have to create a project, implement the logic (program it to your needs).

Your project will be connecting to database, retrieving emails, processing them, logging what was done, etc...

When you compile your project in project_dir/bin/Debug or project/bin/Release (depending how you compiled your project) you will have your libraries and executable. If you double click the executable it will launch your application.

You can copy your executable with dependent libraries (DLLS) to some directory on the server and then create scheduled task.

Alex
A: 

Jon's right. Build a console app and then have Task Scheduler execute it as often as you need it to.

You just need to build it, navigate to the build path for the project and find your .exe there. From there you can copy it to where ever ever you please.

jlafay