public virtual void UpdatePackageReference(string packageId, Version version, bool updateDependencies) { if (String.IsNullOrEmpty(packageId)) { throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "packageId"); } IPackage oldPackage = LocalRepository.FindPackage(packageId); // Check to see if this package is installed if (oldPackage == null) { throw new InvalidOperationException( String.Format(CultureInfo.CurrentCulture, NuGetResources.ProjectDoesNotHaveReference, Project.ProjectName, packageId)); } Logger.Log(MessageLevel.Debug, NuGetResources.Debug_LookingForUpdates, packageId); IPackage package = SourceRepository.FindPackage(packageId, version: version); if (package != null && oldPackage.Version != package.Version) { UpdatePackageReference(package, updateDependencies); } else { Logger.Log(MessageLevel.Info, NuGetResources.Log_NoUpdatesAvailable, packageId); } }
private IPackage GetPackage(PackageReference reference) { if (IsValidReference(reference)) { return(SourceRepository.FindPackage(reference.Id, reference.Version)); } return(null); }
public void UpdatePackageReference(string packageId, IVersionSpec versionSpec, bool updateDependencies, bool allowPrereleaseVersions) { UpdatePackageReference( packageId, () => SourceRepository.FindPackage(packageId, versionSpec, ConstraintProvider, allowPrereleaseVersions, allowUnlisted: false), updateDependencies, allowPrereleaseVersions, targetVersionSetExplicitly: versionSpec != null); }
public IPackage FindPackage(string packageId, SemanticVersion version) { if (!_packageReferenceFile.EntryExists(packageId, version)) { return(null); } return(SourceRepository.FindPackage(packageId, version)); }
public void UpdatePackage(IProjectManager projectManager, string packageId, PackageUpdateMode updateMode, bool updateDependencies, bool allowPrereleaseVersions, ILogger logger) { UpdatePackage(projectManager, packageId, () => UpdatePackageReference(projectManager, packageId, GetUpgradeVersionSpec(projectManager, packageId, updateMode), updateDependencies, allowPrereleaseVersions), () => SourceRepository.FindPackage(packageId, GetUpgradeVersionSpec(packageId, updateMode), allowPrereleaseVersions: false, allowUnlisted: false), updateDependencies, allowPrereleaseVersions, logger); }
public void UpdatePackageToSpecificVersion(string packageId, SemanticVersion version, bool updateDependencies, bool allowPrereleaseVersions, ILogger logger, IPackageOperationEventListener eventListener) { UpdatePackage(packageId, projectManager => UpdatePackageReference(projectManager, packageId, version, updateDependencies, allowPrereleaseVersions), () => SourceRepository.FindPackage(packageId, version, allowPrereleaseVersions, allowUnlisted: false), updateDependencies, allowPrereleaseVersions, logger, eventListener); }
public virtual void UpdatePackageToSpecificVersion(IProjectManager projectManager, string packageId, SemanticVersion version, bool updateDependencies, bool allowPrereleaseVersions, ILogger logger) { UpdatePackage(projectManager, packageId, () => UpdatePackageReference(projectManager, packageId, version, updateDependencies, allowPrereleaseVersions), () => SourceRepository.FindPackage(packageId, version, allowPrereleaseVersions, allowUnlisted: false), updateDependencies, allowPrereleaseVersions, logger); }
public virtual void UpdatePackage(IProjectManager projectManager, string packageId, Version version, bool updateDependencies, ILogger logger) { InitializeLogger(logger, projectManager); bool appliesToProject; IPackage package = FindLocalPackage(projectManager, packageId, null /* version */, CreateAmbiguousUpdateException, out appliesToProject); // Find the package we're going to update to IPackage newPackage = SourceRepository.FindPackage(packageId, version); if (newPackage != null && package.Version != newPackage.Version) { if (appliesToProject) { RunSolutionAction(() => { InstallPackage(newPackage, !updateDependencies); UpdatePackageReference(projectManager, packageId, version, updateDependencies); }); } else { // We might be updating a solution only package UpdatePackage(package, newPackage, updateDependencies); } // Add package to recent repository AddPackageToRecentRepository(newPackage); } else { Logger.Log(MessageLevel.Info, VsResources.NoUpdatesAvailable, packageId); } }
public void UpdatePackage(string packageId, SemanticVersion version, bool updateDependencies, bool allowPrereleaseVersions) { UpdatePackage(packageId, () => SourceRepository.FindPackage(packageId, version, allowPrereleaseVersions, allowUnlisted: false), updateDependencies, allowPrereleaseVersions); }