From 76f5b263221729ab57066d0e57a2a8444239c4cb Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 7 Sep 2023 21:57:23 -0700 Subject: [PATCH] Fixed: Windows Installer hanging on removing previous service --- src/NzbDrone.Host/Bootstrap.cs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/NzbDrone.Host/Bootstrap.cs b/src/NzbDrone.Host/Bootstrap.cs index 36443b308..6997566f7 100644 --- a/src/NzbDrone.Host/Bootstrap.cs +++ b/src/NzbDrone.Host/Bootstrap.cs @@ -54,6 +54,7 @@ namespace NzbDrone.Host Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); var appMode = GetApplicationMode(startupContext); + var config = GetConfiguration(startupContext); switch (appMode) { @@ -82,12 +83,22 @@ namespace NzbDrone.Host // Utility mode default: { - new Container(rules => rules.WithNzbDroneRules()) - .AutoAddServices(ASSEMBLIES) - .AddNzbDroneLogger() - .AddStartupContext(startupContext) - .Resolve() - .Route(appMode); + new HostBuilder() + .UseServiceProviderFactory(new DryIocServiceProviderFactory(new Container(rules => rules.WithNzbDroneRules()))) + .ConfigureContainer(c => + { + c.AutoAddServices(Bootstrap.ASSEMBLIES) + .AddNzbDroneLogger() + .AddDatabase() + .AddStartupContext(startupContext) + .Resolve() + .Route(appMode); + }) + .ConfigureServices(services => + { + services.Configure(config.GetSection("Radarr:Postgres")); + }).Build(); + break; } }