Example #1
0
        // Add update operations to the resolver
        private void AddUpdateOperations(
            string id,
            SemanticVersion version,
            IEnumerable <IProjectManager> projectManagers)
        {
            if (!Safe)
            {
                // Update to latest version
                foreach (var projectManager in projectManagers)
                {
                    AddUnsafeUpdateOperation(
                        id,
                        version,
                        version != null,
                        projectManager);
                }
            }
            else
            {
                // safe update
                foreach (var projectManager in projectManagers)
                {
                    IPackage installedPackage = projectManager.LocalRepository.FindPackage(id);
                    if (installedPackage == null)
                    {
                        continue;
                    }

                    var safeRange = VersionUtility.GetSafeRange(installedPackage.Version);
                    var package   = projectManager.PackageManager.SourceRepository.FindPackage(
                        id,
                        safeRange,
                        projectManager.ConstraintProvider,
                        AllowPrereleaseVersions,
                        allowUnlisted: false);

                    Resolver.AddOperation(PackageAction.Install, package, projectManager);
                }
            }
        }
Example #2
0
 private void AddUpdateOperations(string id, SemanticVersion version, IEnumerable <IProjectManager> projectManagers)
 {
     if (!this.Safe)
     {
         foreach (IProjectManager manager in projectManagers)
         {
             this.AddUnsafeUpdateOperation(id, version, version != null, manager);
         }
     }
     else
     {
         foreach (IProjectManager manager2 in projectManagers)
         {
             IPackage package = manager2.LocalRepository.FindPackage(id);
             if (package != null)
             {
                 IVersionSpec safeRange = VersionUtility.GetSafeRange(package.Version);
                 IPackage     package2  = manager2.PackageManager.SourceRepository.FindPackage(id, safeRange, manager2.ConstraintProvider, this.AllowPrereleaseVersions, false);
                 this.Resolver.AddOperation(PackageAction.Install, package2, manager2);
             }
         }
     }
 }