private List <ProjectInfo> TryGetProjectsInfo(string filePath) { var solutionInfos = new List <ProjectInfo>(); try { var solution = SolutionParser.Parse(filePath); var solutionDirectory = Path.GetDirectoryName(filePath); if (solutionDirectory == null) { _logger.Message($"Solution directory wasn't found for file {filePath}"); return(solutionInfos); } foreach (var project in solution.Projects) { if (project.TypeGuid == ProjectTypeGuids.SolutionFolder) { continue; } var projectFilePath = Path.Combine(solutionDirectory, project.Path); var projectDirectory = Path.GetDirectoryName(projectFilePath); if (projectDirectory == null) { _logger.Message($"Project directory wasn't found for project {project.Name}"); return(solutionInfos); } var packageConfigPath = Path.Combine(projectDirectory, "packages.config"); if (File.Exists(packageConfigPath)) { var packages = _projectParser.ParsePackageConfig(packageConfigPath); solutionInfos.Add(new ProjectInfo(project.Name, packages)); } else if (File.Exists(projectFilePath)) { var packages = _projectParser.ParseProjectFile(projectFilePath); solutionInfos.Add(new ProjectInfo(project.Name, packages)); } else { _logger.Message($"Unable to find project or package.config file for project {project.Path}"); } } return(solutionInfos); } catch (Exception e) { _logger.Message($"Unable to get project info for {filePath}\r\n {e}"); } return(solutionInfos); }