Making an existing exe with gui into windows service

只愿长相守 提交于 2019-12-20 02:27:21

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/8968672/making-an-existing-exe-with-gui-into-windows-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!