private void AnalyzePackages(PackagesConfig config) { Console.Write("Analyzing packages... "); foreach (var package in config.AllPackages().Select(e => e.AsPackage())) { var log = new LogPackage { PackageId = package.Id, ProjectName = m_checker.ProjectName(package.Id), IsLocal = m_checker.IsLocal(package.Id), IsStatic = m_checker.IsStatic(package.Id), SourceVersion = package.Version, PinnedToCurrent = m_checker.IsPinnedToCurrentVersion(package.Id), PinnedToSpecific = m_checker.IsPinnedToSpecificVersion(package.Id), IsDependency = m_checker.IsDependency(package.Id), IsBundle = m_checker.IsBundle(package.Id) }; SetupProjectUrl(log); m_log.Add(package.Id, log); } Console.WriteLine("OK"); }
private void UpdateReferenceVersions(ProjectDocument project) { Console.Write("Updating reference versions... "); foreach (var reference in project.GetBinaryReferences()) { // skip assemblies from GAC if (reference.IsGlobal) { continue; } // skip remote packages if (!m_checker.IsLocal(reference.Name)) { continue; } // skip static packages if (m_checker.IsStatic(reference.Name)) { continue; } // package should be pinned to its current version if (m_checker.IsPinnedToCurrentVersion(reference.Name)) { continue; } // get version to use for local package var versionToUse = m_checker.VersionToUse(reference.Name); // update is not required if (versionToUse.Normalize() == reference.Version.Normalize()) { continue; } // update package version within project file reference.UpdateVersion(versionToUse); } Console.WriteLine("OK"); }
public void UpdateAll() { if (!File.Exists(Paths.PackagesConfig)) { return; } Console.WriteLine("Update remote packages..."); var config = new PackagesConfig(Paths.PackagesConfig); foreach (var package in config.AllPackages().Select(e => e.AsPackage())) { // skip local packages if (m_checker.IsLocal(package.Id)) { continue; } // package should be pinned to its current version if (m_checker.IsPinnedToCurrentVersion(package.Id)) { continue; } // try to update remote package UpdatePackage(package.Id); } // update build versions for updated packages config = new PackagesConfig(Paths.PackagesConfig); foreach (var package in config.AllPackages().Select(e => e.AsPackage())) { m_log[package.Id].BuildVersion = package.Version; } }