private static void RecreateConfigurationFileIfMissing(string configurationFile) { if (!IOFile.Exists(configurationFile)) { try { Log.Warning("Configuration file {ConfigurationFile} does not exist; creating from example", configurationFile); var source = Path.Combine(AppContext.BaseDirectory, "config", $"{AppName}.example.yml"); var destination = configurationFile; IOFile.Copy(source, destination); } catch (Exception ex) { Log.Error("Failed to create configuration file {ConfigurationFile}: {Message}", configurationFile, ex.Message); } } }