diff --git a/Source/MDKServices/HealthAnalysis.cs b/Source/MDKServices/HealthAnalysis.cs index e782bf0..d87f006 100644 --- a/Source/MDKServices/HealthAnalysis.cs +++ b/Source/MDKServices/HealthAnalysis.cs @@ -30,14 +30,33 @@ public class HealthAnalysis /// /// /// - public static Task AnalyzeAsync(Solution solution, HealthAnalysisOptions options) => System.Threading.Tasks.Task.WhenAll(solution.Projects.Cast().Select(project => System.Threading.Tasks.Task.Run(() => Analyze(project, options)))); + public static Task AnalyzeAsync(Solution solution, HealthAnalysisOptions options) { + var projectTaks = GetProjects(solution.Projects.Cast()).Select(project => System.Threading.Tasks.Task.Run(() => Analyze(project, options))); + return System.Threading.Tasks.Task.WhenAll(projectTaks); + } + + private const string C_SHARP_PROJECT_KIND = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"; + + private static IEnumerable GetProjects(IEnumerable projects) { + var result = new List(); + foreach (var project in projects) { + if (new Guid(project.Kind) == new Guid(C_SHARP_PROJECT_KIND)) + result.Add(project); + else if (project.ProjectItems != null) + { + result.AddRange(GetProjects(project.ProjectItems.Cast().Select(x => x.SubProject).OfType())); + } + } + return result; + } // ReSharper disable once InconsistentNaming private const int RPC_E_SERVERCALL_RETRYLATER = unchecked((int)0x8001010A); + static HealthAnalysis Analyze(Project project, HealthAnalysisOptions options) { - options.Echo?.Invoke("Analyzing project..."); + options.Echo?.Invoke($"{project.Name}: Analyzing project..."); while (true) { try