I usually develop any program as a class library (or a set of libraries) with a logical entry point, then add the shell of the startup project: a console application, a Windows service, a website.
If you have an entry point in your program (a class with a method that runs all your business logic), you can create it as a class library without any changes and add a console project and a Windows service project to your solution, which is basically a class (for example, Program.cs) instantiates an entry point and calls an input method.
This approach does not affect your business logic using the approach and allows you to create every use method every time you build an entire solution. In other words, this allows us to separate the problems: the program and how to run it.
source share