public static int Main(string[] args) { try { Directory.CreateDirectory(ConfigurationDirectory); var app = new CliApplicationBuilder() .ConfigureServices(ConfigureServices) .ConfigureOptions(ConfigureOptions) .ConfigureTools() .Build(); _console.CancelKeyPress += (s, e) => app.ServiceProvider.GetRequiredService <IProcessService>().KillAllStartedProcesses(); return(app.Run(args)); } catch (Exception ex) { return(HandleError(ex)); } }