diff --git a/src/MfGames.ToolBuilder/ToolBuilder.cs b/src/MfGames.ToolBuilder/ToolBuilder.cs index cbd41f2..572e373 100644 --- a/src/MfGames.ToolBuilder/ToolBuilder.cs +++ b/src/MfGames.ToolBuilder/ToolBuilder.cs @@ -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(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( + this.ConfigureContainer); } ///