fix: switched from default host builder to avoid directory scan on Linux
This commit is contained in:
parent
9aaed2ee20
commit
e59d489a06
1 changed files with 25 additions and 8 deletions
|
@ -49,14 +49,31 @@ namespace MfGames.ToolBuilder
|
|||
this.loggingService.Configure(arguments);
|
||||
|
||||
// Start up the basic configuration.
|
||||
this.hostBuilder = Host
|
||||
.CreateDefaultBuilder(arguments)
|
||||
.UseConsoleLifetime()
|
||||
.ConfigureAppConfiguration(this.ConfigureAppConfiguration)
|
||||
.UseSerilog()
|
||||
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||
.ConfigureServices(this.ConfigureServices)
|
||||
.ConfigureContainer<ContainerBuilder>(this.ConfigureContainer);
|
||||
//
|
||||
// Normally, we would use Host.CreateDefaultBuilder(args) to create
|
||||
// this, but when run as a stand-alone application in someone's
|
||||
// $HOME on Linux, this causes an inotify watcher to be registered
|
||||
// on the entire directory tree (which takes a really long time).
|
||||
//
|
||||
// We also don't need most of the default features.
|
||||
this.hostBuilder =
|
||||
new HostBuilder()
|
||||
.UseDefaultServiceProvider(
|
||||
(context, options) =>
|
||||
{
|
||||
bool isDevelopment =
|
||||
context.HostingEnvironment.IsDevelopment();
|
||||
options.ValidateScopes = isDevelopment;
|
||||
options.ValidateOnBuild = isDevelopment;
|
||||
})
|
||||
.UseConsoleLifetime()
|
||||
.ConfigureAppConfiguration(this.ConfigureAppConfiguration)
|
||||
.UseSerilog()
|
||||
.UseServiceProviderFactory(
|
||||
new AutofacServiceProviderFactory())
|
||||
.ConfigureServices(this.ConfigureServices)
|
||||
.ConfigureContainer<ContainerBuilder>(
|
||||
this.ConfigureContainer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Reference in a new issue