For testing purposes, I have an old .Net app with a WinForms GUI that is also a web service, i.e., receives and responds to HTTP messages. While running, it displays received messages and is interactive for querying additional info, etc. This was relatively easy to develop (years ago).
I would like to convert this tool to ASP.NET Core. I have been able to convert a pure WinForms app with no problem, and can create a pure web service, but I have not found a way to combine the two. I need use <Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
in the project file to get access to Winforms, but that causes all kinds of 'undefined' errors for things like IWebHostEnvironment, etc.
In short, is there a way to create a web service that also has a local desktop GUI? I think I need both "Microsoft.NET.Sdk.WindowsDesktop" and "Microsoft.NET.Sdk.Web". (Note: I'm not worried about cross-platform portability.)
I've tried adding the following packages, but so far without success:
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.7" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.9" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.9" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.9" />
<PackageReference Include="System.Resources.Extensions" Version="4.7.1" />
</ItemGroup>