All it takes is an 8 step process, using MS Visual Studio:
- Create a new service project, in MS Visual Studio
- Add the OnStart and OnStop procedures
- Modify the project to display changes in the service status
- Add Installers to the project
- Set the Startup parameters
- Build the new service
- Test the new service, by installing and starting it on the local machine
- Uninstall the service from the local machine
For more details on how to create a new service, see the reference link below.
Reference:
https://docs.microsoft.com/en-us/dotnet/framework/windows-services/walkthrough-creating-a-windows-service-application-in-the-component-designer