C
C#2y ago
PatrickG

❔ 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
PatrickG
PatrickGOP2y ago
this is my project reference
PatrickG
PatrickGOP2y ago
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
FusedQyou
FusedQyou2y ago
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 general
PatrickG
PatrickGOP2y ago
well 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
FusedQyou
FusedQyou2y ago
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 namespace
Accord
Accord2y ago
Was 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.
Want results from more Discord servers?
Add your server