The context is .Net Core Worker Service. I want to run it as a Windows Service when deployed on a Windows OS and as a daemon when deployed on a Linux OS. But I want to keep only one binary for deployment on both Windows and Linux.
This article (and many other) pipe either UseWindowsService or UseSystemd, which means that in order for this worker service to run on Winodws and Linux, has to have two different binaries.
As I am new to DotNet Core, I want to learn/know whether or not it can conditionally pipe the UseWindowsService/UseSystemd based on the OS - keeping only one binary.