diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs index 7897de876b..993d0fb04b 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs @@ -72,9 +72,6 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon .Add("allowdowngrade|allow-downgrade", "AllowDowngrade - Should an attempt at downgrading be allowed? Defaults to false.", option => configuration.AllowDowngrade = option != null) - .Add("m|sxs|sidebyside|side-by-side|allowmultiple|allow-multiple|allowmultipleversions|allow-multiple-versions", - "AllowMultipleVersions - Should multiple versions of a package be installed? Defaults to false. (DEPRECATED)", - option => configuration.AllowMultipleVersions = option != null) .Add("i|ignoredependencies|ignore-dependencies", "IgnoreDependencies - Ignore dependencies when installing package(s). Defaults to false.", option => configuration.IgnoreDependencies = option != null) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs index 50835e0a04..e5021551d9 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs @@ -66,9 +66,6 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon .Add("paramsglobal|params-global|packageparametersglobal|package-parameters-global|applyparamstodependencies|apply-params-to-dependencies|apply-package-parameters-to-dependencies", "Apply Package Parameters To Dependencies - Should package parameters be applied to dependent packages? Defaults to false.", option => configuration.ApplyPackageParametersToDependencies = option != null) - .Add("m|sxs|sidebyside|side-by-side|allowmultiple|allow-multiple|allowmultipleversions|allow-multiple-versions", - "AllowMultipleVersions - Should multiple versions of a package be installed? Defaults to false. (DEPRECATED)", - option => configuration.AllowMultipleVersions = option != null) .Add("x|forcedependencies|force-dependencies|removedependencies|remove-dependencies", "RemoveDependencies - Uninstall dependencies when uninstalling package(s). Defaults to false.", option => configuration.ForceDependencies = option != null) diff --git a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs index 21ffa63170..fef984b138 100644 --- a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs +++ b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs @@ -332,9 +332,6 @@ private void append_output(StringBuilder propertyValues, string append) public bool ApplyInstallArgumentsToDependencies { get; set; } public bool IgnoreDependencies { get; set; } - [Obsolete("Side by Side installation is deprecated, and is pending removal in v2.0.0")] - public bool AllowMultipleVersions { get; set; } - public bool AllowDowngrade { get; set; } public bool ForceDependencies { get; set; } public string DownloadChecksum { get; set; } diff --git a/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs b/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs index 1406554cca..5ae1003d5b 100644 --- a/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs +++ b/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs @@ -73,7 +73,7 @@ private static IConsole Console public static ChocolateyPackagePathResolver GetPathResolver(ChocolateyConfiguration configuration, IFileSystem nugetPackagesFileSystem) { - return new ChocolateyPackagePathResolver(ApplicationParameters.PackagesLocation, nugetPackagesFileSystem, configuration.AllowMultipleVersions); + return new ChocolateyPackagePathResolver(ApplicationParameters.PackagesLocation, nugetPackagesFileSystem, useSideBySidePaths: false); } public static void ClearRepositoriesCache() diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index 502ddb9aba..957b3cbe06 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -564,9 +564,9 @@ public virtual ConcurrentDictionary install_run(Chocolate latestPackageVersion = installedPackage.PackageMetadata.Version; } - if (installedPackage != null && version != null && version < installedPackage.PackageMetadata.Version && !config.AllowMultipleVersions && !config.AllowDowngrade) + if (installedPackage != null && version != null && version < installedPackage.PackageMetadata.Version && !config.AllowDowngrade) { - string logMessage = "A newer version of {0} (v{1}) is already installed.{2} Use --allow-downgrade or --force to attempt to install older versions, or use --side-by-side to allow multiple versions.".format_with(installedPackage.Name, installedPackage.Version, Environment.NewLine); + string logMessage = "A newer version of {0} (v{1}) is already installed.{2} Use --allow-downgrade or --force to attempt to install older versions.".format_with(installedPackage.Name, installedPackage.Version, Environment.NewLine); var nullResult = packageResultsToReturn.GetOrAdd(packageName, installedPackage); nullResult.Messages.Add(new ResultMessage(ResultType.Error, logMessage)); this.Log().Error(ChocolateyLoggers.Important, logMessage); @@ -707,20 +707,14 @@ Version was specified as '{0}'. It is possible that version resolvedPackages = dependencyResolver.Resolve(resolverContext, CancellationToken.None) .Select(p => sourcePackageDependencyInfos.Single(x => PackageIdentityComparer.Default.Equals(x, p))); - if (!config.ForceDependencies) { var identitiesToUninstall = packagesToUninstall.Select(x => x.Identity); resolvedPackages = resolvedPackages.Where(p => !(localPackagesDependencyInfos.Contains(p) && !identitiesToUninstall.Contains(p))); - if (!config.AllowMultipleVersions) - { - // If forcing dependencies, then dependencies already added to packages to remove - // If allow multiple is added, then new version of dependency will be added side by side - // If neither, then package needs to be removed so it can be upgraded to the new version required by the parent - - packagesToUninstall.AddRange(allLocalPackages.Where(p => resolvedPackages.Select(x => x.Id).Contains(p.Name, StringComparer.OrdinalIgnoreCase))); - } + // If forcing dependencies, then dependencies already added to packages to remove. + // If not forcing dependencies, then package needs to be removed so it can be upgraded to the new version required by the parent + packagesToUninstall.AddRange(allLocalPackages.Where(p => resolvedPackages.Select(x => x.Id).Contains(p.Name, StringComparer.OrdinalIgnoreCase))); } } catch (NuGetResolverConstraintException ex) @@ -1041,9 +1035,9 @@ public virtual ConcurrentDictionary upgrade_run(Chocolate var pathResolver = NugetCommon.GetPathResolver(config, _fileSystem); var nugetProject = new FolderNuGetProject(ApplicationParameters.PackagesLocation, pathResolver, NuGetFramework.AnyFramework); - if (version != null && version < installedPackage.PackageMetadata.Version && !config.AllowMultipleVersions && !config.AllowDowngrade) + if (version != null && version < installedPackage.PackageMetadata.Version && !config.AllowDowngrade) { - string logMessage = "A newer version of {0} (v{1}) is already installed.{2} Use --allow-downgrade or --force to attempt to upgrade to older versions, or use side by side to allow multiple versions.".format_with(installedPackage.PackageMetadata.Id, installedPackage.Version, Environment.NewLine); + string logMessage = "A newer version of {0} (v{1}) is already installed.{2} Use --allow-downgrade or --force to attempt to upgrade to older versions.".format_with(installedPackage.PackageMetadata.Id, installedPackage.Version, Environment.NewLine); var nullResult = packageResultsToReturn.GetOrAdd(packageName, new PackageResult(installedPackage.PackageMetadata, pathResolver.GetInstallPath(installedPackage.PackageMetadata.Id, installedPackage.PackageMetadata.Version))); nullResult.Messages.Add(new ResultMessage(ResultType.Error, logMessage)); this.Log().Error(ChocolateyLoggers.Important, logMessage); @@ -1301,14 +1295,9 @@ public virtual ConcurrentDictionary upgrade_run(Chocolate var identitiesToUninstall = packagesToUninstall.Select(x => x.Identity); resolvedPackages = resolvedPackages.Where(p => !(localPackagesDependencyInfos.Contains(p) && !identitiesToUninstall.Contains(p))); - if (!config.AllowMultipleVersions) - { - // If forcing dependencies, then dependencies already added to packages to remove - // If allow multiple is added, then new version of dependency will be added side by side - // If neither, then package needs to be removed so it can be upgraded to the new version required by the parent - - packagesToUninstall.AddRange(allLocalPackages.Where(p => resolvedPackages.Select(x => x.Id).Contains(p.Name, StringComparer.OrdinalIgnoreCase))); - } + // If forcing dependencies, then dependencies already added to packages to remove. + // If not forcing dependencies, then package needs to be removed so it can be upgraded to the new version required by the parent + packagesToUninstall.AddRange(allLocalPackages.Where(p => resolvedPackages.Select(x => x.Id).Contains(p.Name, StringComparer.OrdinalIgnoreCase))); } } catch (NuGetResolverConstraintException ex) @@ -1820,16 +1809,14 @@ protected virtual void ensure_package_files_have_compatible_attributes(Chocolate [Obsolete("This overload is obsolete and will be removed in a future version.")] public virtual void rename_legacy_package_version(ChocolateyConfiguration config, IPackageMetadata installedPackage, ChocolateyPackageInformation pkgInfo) - => normalize_package_legacy_folder_name(config, installedPackage, pkgInfo); + => normalize_package_legacy_folder_name(config, installedPackage); - protected virtual void normalize_package_legacy_folder_name(ChocolateyConfiguration config, IPackageMetadata installedPackage, ChocolateyPackageInformation pkgInfo) + protected virtual void normalize_package_legacy_folder_name(ChocolateyConfiguration config, IPackageMetadata installedPackage) { - if (pkgInfo != null && pkgInfo.IsSideBySide) return; - var installDirectory = _fileSystem.combine_paths(ApplicationParameters.PackagesLocation, installedPackage.Id); if (!_fileSystem.directory_exists(installDirectory)) { - // if the folder has a version on it, we need to rename the folder first. + // Legacy resolver mode: if the folder has a version on it, we need to rename the folder first. var pathResolver = new ChocolateyPackagePathResolver(ApplicationParameters.PackagesLocation, _fileSystem, useSideBySidePaths: true); installDirectory = pathResolver.GetInstallPath(new PackageIdentity(installedPackage.Id, installedPackage.Version)); if (_fileSystem.directory_exists(installDirectory)) @@ -2374,7 +2361,7 @@ protected void backup_existing_package_files(ChocolateyConfiguration config, IPa { remove_rollback_directory_if_exists(package.Id); ensure_package_files_have_compatible_attributes(config, package); - normalize_package_legacy_folder_name(config, package, packageInformation); + normalize_package_legacy_folder_name(config, package); backup_existing_version(config, packageInformation); remove_shim_directors(config, package); }