/// <summary> /// Dumps the environment names from the data source to the console. /// </summary> /// <param name="context">The preprocessing context.</param> /// <returns></returns> private static int DumpEnvironments(PreprocessingContext context) { int exitCode = 0; try { DataSource firstDataSource = context.DataSources[0]; SettingsLoader loader = new SettingsLoader(context); DataTable settingsTable = loader.LoadDataTableFromDataSource(firstDataSource); List <string> environments = loader.GetEnvironmentsFromDataTable(settingsTable); foreach (string environment in environments) { if (!string.IsNullOrEmpty(context.PropertyToExtract)) { PreprocessingProperties properties = new PreprocessingProperties(context.FixFalse); loader.LoadSettingsFromDataTable(settingsTable, context.Properties, environment); PreprocessingProperty property = context.Properties[context.PropertyToExtract]; if (null != property) { string resolvedPropertyValue = context.ResolveContent(property.Value); if (!string.IsNullOrEmpty(resolvedPropertyValue)) { Console.WriteLine(resolvedPropertyValue); } } } else { Console.WriteLine(environment); } } } catch (Exception e) { ConsoleUtils.WriteLine(ConsoleColor.Red, e.Message); exitCode = 1; } return(exitCode); }