This is one way of building windows services using .net core.
It is built using P/Invoke calls into native windows assemblies.
Example of writing windows service (taken from github project's page):
using DasMulli.Win32.ServiceUtils;
class Program
{
public static void Main(string[] args)
{
var myService = new MyService();
var serviceHost = new Win32ServiceHost(myService);
serviceHost.Run();
}
}
class MyService : IWin32Service
{
public string ServiceName => "Test Service";
public void Start(string[] startupArguments, ServiceStoppedCallback serviceStoppedCallback)
{
// Start coolness and return
}
public void Stop()
{
// shut it down again
}
}
It is not perfect but IMHO it is pretty nice.