コード例 #1
0
ファイル: UpdateUtility.cs プロジェクト: pratikkagda/nuget
        // 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);
                }
            }
        }
コード例 #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);
             }
         }
     }
 }