/// <summary> /// Provides any project file paths referenced by the input project file, and any project file paths referenced by those project file paths, and so on recursively, until all project file paths are accumulated. /// </summary> public static ProjectFilePath[] GetProjectReferencedProjectFilePathsRecursive(ProjectFilePath projectFilePath, ILogger logger) { var uniqueProjects = new HashSet <ProjectFilePath>(); var queue = new Queue <ProjectFilePath>(); queue.Enqueue(projectFilePath); // Do not include the initial project file path in the output list of referenced project file paths. while (queue.Count > 0) { var currentProjectFilePath = queue.Dequeue(); logger.LogDebug($"Getting project-references for: {currentProjectFilePath}"); var currentProjectReferencedProjects = DotnetCommandServicesProvider.GetProjectReferencedProjectFilePaths(currentProjectFilePath); foreach (var referencedProject in currentProjectReferencedProjects) { if (!uniqueProjects.Contains(referencedProject)) { uniqueProjects.Add(referencedProject); queue.Enqueue(referencedProject); } } } var projectFilePaths = new List <ProjectFilePath>(uniqueProjects); projectFilePaths.Sort(); return(projectFilePaths.ToArray()); }
public ProjectFilePath[] GetProjectReferenceFilePaths(ProjectFilePath projectFilePath) { var projectFilePaths = DotnetCommandServicesProvider.GetProjectReferencedProjectFilePaths(projectFilePath); return(projectFilePaths); }