❔ help HostApplicationBuilder
Hi im trying to follow https://learn.microsoft.com/en-us/dotnet/core/extensions/windows-service
my code can't find the HostApplicationBuilder class even though i installed the required nuget package.
Create Windows Service using BackgroundService - .NET
Learn how to create a Windows Service using the BackgroundService in .NET.
6 Replies
this is my project reference
I cant get exactle the same thing as in the tutorial because it seems on .net 6 i can only install microsoft.extensions.hosting v 6.0.1
So why don't you migrate to .NET 7 then?
Right now you have a mismatch since
Microsoft.Extensions.Hosting.WindowsServices
is for .NET 7, and you're following a .NET 7 tutorial in generalwell in the tutorial it says it takes .net 6 or later
and we don't really use .net 7 yet at my job so i wanna do it in .net 6
Well try downgrading it to one for .NET 6 first
I'm guessing the main error has to do with what
Host
you are currently referencing
As you can see it has access to a Host
class, but this does not have the CreateApplicationBuilder
method
So my guess is you imported the wrong namespaceWas this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.