private static void PrintIncludeInBuildSummary(Options options, SolutionFile sln) { var projectsInConfigurations = new List <ProjectIncludeInBuildSummary>(); foreach (var prj in sln.ProjectsInOrder.OrderBy(x => x.ProjectName)) { foreach (var c in prj.ProjectConfigurations.OrderBy(c => new ConfigurationAndPlatform(c.Key).PlatformName)) { var solutionConf = new ConfigurationAndPlatform(c.Key); var projectConf = c.Value; var projectPlatform = new ProjectIncludeInBuildSummary(prj.ProjectName, solutionConf.PlatformName); var last = projectsInConfigurations.LastOrDefault(); if (last == null || last.PlatformName != projectPlatform.PlatformName || last.ProjectName != projectPlatform.ProjectName) { projectPlatform.Configurations.Add(Tuple.Create(solutionConf.ConfigurationName, projectConf.IncludeInBuild)); projectsInConfigurations.Add(projectPlatform); } else { last.Configurations.Add(Tuple.Create(solutionConf.ConfigurationName, projectConf.IncludeInBuild)); } } } Console.WriteLine($"\n\n---------------------------\n\n"); if (options.OrderByPlatform) { projectsInConfigurations = projectsInConfigurations.OrderBy(x => x.PlatformName).ToList(); } foreach (var p in projectsInConfigurations) { bool allIncluded = p.Configurations.All(t => t.Item2); bool allExcluded = p.Configurations.All(t => !t.Item2); string sign = allIncluded ? "+" : allExcluded ? "-" : "?"; string configs = string.Join(", ", p.Configurations.OrderBy(t => t.Item1) .Select(t => $"({t.Item1} {(t.Item2 ? "+" : "-")})")); Console.WriteLine($"{p.ProjectName,-30} {p.PlatformName,-30} {sign}\t [{configs}]"); } }
private static void ProcessProject(ProjectInSolution prj, Options options) { var projectConfigurations = options.Platform != null?prj.ProjectConfigurations.Where(c => new ConfigurationAndPlatform(c.Key).PlatformName == options.Platform) : prj.ProjectConfigurations; projectConfigurations = options.Configuration != null?projectConfigurations.Where(c => new ConfigurationAndPlatform(c.Key).ConfigurationName == options.Configuration) : projectConfigurations; if (options.OrderByPlatform) { projectConfigurations = projectConfigurations.OrderBy(c => new ConfigurationAndPlatform(c.Key).PlatformName); } foreach (var c in projectConfigurations) { var solutionConf = new ConfigurationAndPlatform(c.Key); var projectConf = c.Value; var prefix = options.Project == null ? $"{prj.ProjectName,-30}" : ""; string warn = solutionConf.ConfigurationName != projectConf.ConfigurationName ? "!!" : " "; warn += solutionConf.PlatformName != projectConf.PlatformName ? "!!" : " "; Console.WriteLine($"{prefix}{solutionConf.ConfigurationName,-20} | {solutionConf.PlatformName,-30} : {projectConf.ConfigurationName,-20} | {projectConf.PlatformName,-30} {(projectConf.IncludeInBuild ? "+" : "-")} {warn}"); } }