Marthin
Marthin

Reputation: 6543

Making an existing exe with gui into windows service

I have a c# project that is more or less a exe file with a GUI ontop to make some settings. The projects purpose is to collect data either when the users forces a collect or when a time has been reached everyday that has been set by the user. There is also an installer project for this, all bundled in VS2010 for .NET 3.0. I would like to take part of my code to be used by windows service. The part that everyday at a given time should perform a collect data operation.

So my question is, can I do this in the same project or should I create a new project for this? Do I then need to create a new installer or can I have it all installed by the same project? And if so, how? So I more or less asking for tips from anyone who has done the same thing as I'm trying to do.

Upvotes: 3

Views: 4657

Answers (1)

Myles McDonnell
Myles McDonnell

Reputation: 13335

If you haven't already, you should split your code into two projects. One class library that implements the behaviour/functionality you need, and the other Winform app that references the class lib. project. Now create a Window Service project that refs. the class lib. You can then create a new MSI project as the installer for the service.

Also read intro to windows services

Upvotes: 4

Related Questions