Just add the following package.
Microsoft.Extensions.Hosting.WindowsServices
Then all you have to do is add UseWindowsService() to your host builder and its ready to use.
I’m using the worker service template to show how to install it.
To install it just run the following command in a adminstrator cmd prompt.