public IEnumerable <ProjectNuspecResult> ConsolidateSolution(SolutionResult solution)
        {
            var projectsToCheck = solution.Projects.Where(a => a.HasNuspec && a.References.Count() > 0);

            foreach (var project in projectsToCheck)
            {
                var docu = ProjectReader.GetDocument(project.NuspecInfo.FullName);

                var dependencies = NuspecUpdater.GetDependencies(docu);

                var missing = CheckMissingPackages(dependencies, ParseReferences(project.References));

                var useless = CheckUselessPackages(dependencies, ParseReferences(project.References));

                if (missing.Any() || useless.Any())
                {
                    yield return(new ProjectNuspecResult
                    {
                        Project = project,
                        MissingPackages = missing,
                        UselessPackages = useless
                    });
                }
            }
        }
Exemple #2
0
        public static bool UpdateNuspec(ProjectNuspecResult input)
        {
            var docu = ProjectReader.GetDocument(input.Project.NuspecInfo.FullName);

            docu = UpdateNuspec(docu, input.MissingPackages, input.UselessPackages);

            var allDependencies = GetDependencies(docu);

            docu.Save(input.Project.NuspecInfo.FullName);

            return(input.MissingPackages.All(a => allDependencies.Contains(a)) &&
                   input.UselessPackages.All(a => !allDependencies.Contains(a)));
        }