I see various tutorials online about building a .NET Core console app and building an ASP.NET Core app, but what I don't find is something about building a .NET Core console app that starts with console output but also contains an ASP.NET web app. In this case I am writing an app that runs as a Windows or a Linux service. It runs as a daemon. So I'm now looking to add an ASP.NET Core web interface to output status information.
Is there a recommended way to do this? I presume I need to create a WebHostBuilder and create my new WebHost with .Build(), but should I create a new project for this and reference it from my console app project? If so, which SDK should it use for the project? I can't use Microsoft.NET.Sdk.Web because that requires a Main method which I obviously don't want to have if this is going to be referenced from an existing app that has its own Main method, but if I use Microsoft.NET.Sdk.Razor, I seem to get a bunch of dependency version conflicts and errors like:
Version conflict detected for Microsoft.Extensions.Configuration.Abstractions. Install/reference Microsoft.Extensions.Configuration.Abstractions 2.1.1 directly to project MyProject to resolve this issue.
So I feel like I'm missing something fundamental here; what exactly is the best practice for embedding a web app inside a console app in .NET Core?