Repository navigation
Expand --version option to allow range #800
Copy link
Copy link
Open
Labels
0 - BacklogIssue is accepted, but is not ready to be worked on or not in current sprint.Issue is accepted, but is not ready to be worked on or not in current sprint.ClickUp - BacklogUsed when syncing issues between GitHub and Clickup.Used when syncing issues between GitHub and Clickup.CustomerBug reported or feature requested by a licensed customer of Chocolatey.Bug reported or feature requested by a licensed customer of Chocolatey.EnhancementIssues that introduce new functionality to the project, or enhances/updates existing functionality.Issues that introduce new functionality to the project, or enhances/updates existing functionality.
Milestone
Description
Summary
Currently, issuing upgrades of packages restricted to a major version requires a unique id. This is typically done by appending the version to the id such as with community dotnet packages, e.g. dotnet3, dotnet4, etc.
Proposal
Use nuspec versioning (as already used in nuspec files to determine valid dependency version) to select version with choco. This could be for install/upgrade/pin etc.
Current
--version=VALUE
Version - A specific version to install.
Proposed
--version=2.0, --version=[2.0]
Version - Select exact version.
--version=[1.0,2.0)
Version - Select most recent version from a range >=1.0 && <2.0
--version=(,2.0)
Version - Select most recent version from a range >0.0 && <2.0.
For example, if you wanted to restrict install of a package to version 9.0
Just like when declaring a dependency in *.nuspec:
<dependencies>
<dependency id="example" version="[9.0,10.0)" />
</dependencies>one time use: choco install example --version=[9.0,10.0)
stored use (pin): choco pin add -n=example --version [9.0,10.0)
Adding #798 would be a very nice complement to this.
Related
┆Issue is synchronized with this Clickup task by Unito
Reacted by slawomir-brzezinski-at-interxion, Saran Tanpituckpong ✔️, watashiSHUN, Dominik Janiec, vosr, pklapperich, Alex Babrykovich, verglor, marcinsmialek, Aleš and 46 more
Reacted by Michael Voříšek and Zachary Siegel
Reacted by Michael Voříšek and Zachary Siegel
Metadata
Metadata
Assignees
Labels
0 - BacklogIssue is accepted, but is not ready to be worked on or not in current sprint.Issue is accepted, but is not ready to be worked on or not in current sprint.ClickUp - BacklogUsed when syncing issues between GitHub and Clickup.Used when syncing issues between GitHub and Clickup.CustomerBug reported or feature requested by a licensed customer of Chocolatey.Bug reported or feature requested by a licensed customer of Chocolatey.EnhancementIssues that introduce new functionality to the project, or enhances/updates existing functionality.Issues that introduce new functionality to the project, or enhances/updates existing functionality.
Activity
ferventcoder commentedon Jun 15, 2016
I think this has already been logged. If not 👍
ferventcoder commentedon Jun 15, 2016
Similar - #688
ferventcoder commentedon Jun 15, 2016
@dtgm Summary/proposal - do you think this is something we could enhance the template with?
ferventcoder commentedon Jun 15, 2016
Pushing this out a bit - it's a good feature, but requires a lot of working parts to change.
dtgm commentedon Jun 15, 2016
@ferventcoder I figured it had to been logged too, but couldn't find with search. Probably still on the old chocolatey repo issue tracker.
Adding to template? On one hand, it clarifies the situation, on the other, it may encourage people to a bunch of packages that should be deprecated when the feature gets implemented. I mean right now we have
teamviewer,teamviewer7,teamviewer8,teamviewer9,teamviewer10.... I would see a lot of packages needing to the same. Also, it can be hard to declare a dependency sometimes as sometimes packages get created with also minor versions, dotnet4.6 and dotnet4.6.1. So a package declaring dotnet4.6 as a dependency will not get upgraded since 4.6.1 is a different package (saw that when I was looking atpaint.net). But I can easily see this affecting businesses just as well that want a easily maintainable upgrade channel for supporting different versions among their different environments.How does nuget handle interpreting the dependency xml element? Can we leverage what they are doing there? We would probably want to separate out interpreting the version and call on that as required to retrieve the latest version within the provided parameters(?)
ferventcoder commentedon Jun 15, 2016
Bigger discussion - .NET 4.6 and 4.6.1 may be side by side installs.
dtgm commentedon Jun 15, 2016
^^^ Widens scope for sure if needing to handle multiple versions of same id, which dotnet would. That should probably get logged as a new feature enhancement that would build upon this one.
-mis implemented-mdoesn't work for dependency packages, right?For example,
adependent oncversion ==1.0bdependent oncversion ==2.0I think the behavior is if
bis installed,awill still install, butcwill remain as2.0There would have to be a way to follow the dependencies strict with
-mrecursive option, which would work for dotnet which installs the versions to different registry keys. But would be bad if not used correctly by packages as allowing side-by-side packages to install is meaningless if the package just reinstalls to the same registry key.ferventcoder commentedon Jun 16, 2016
Our recommendation is that for when the natively installed app can have two versions of it installed, that is two different packages. So .NET Framework 3.5 versus .NET Framework 4.5. Those are different installs, thus different packages.
dtgm commentedon Jun 17, 2016
I agree and it should continue like that for now, but also ... stop and dream a little, man!
Imagine a world where all the dotnetX maintainers worked together....
Imagine a world where packages depended on dotnet and specified version required....
Most programs just need at least a certain version of installed, say dotnet >=4.0
So if dotnet4.6 is installed, well, gonna need to install dotnet 4.0 too because it is a separate package, and that builds a needlessly bloated system.
But many programs also do require a specific version so it's not a solution to merge them all until there is some mechanism to say, "Hey, dependency X, I know we already have a version of you installed, but we need you too, bruh."
Requiring side-by-side install of latest release in 4.5.x.x
So by adding an attribute
force(or whatever) todependencyelement, that dependent package would be forced to be installed side-by-side (-m), rather than prompting an upgrade per usual....BUT that would still introduce bloat, only more slowly, if even one package misused this property since it would be way more difficult to determine no longer relevant dependent packages. But that is a job for a dependency cleaner that I am just going to very conveniently assume that is already well developed and will magically handle all of that.jberezanski commentedon Jun 17, 2016
I've been thinking about converging the .NET packages for quite a while now (as hinted here). There are exactly two packages needed, one for each .NET "family": 2.x/3.x (2.0, 3.0, 3.5, 3.5.1) and 4.x (4.0, 4.0.1, 4.0.2, 4.0.3, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2). Both families are independent of each other and install side-by-side. Within each family, each new release completely overwrites/supersedes the older ones, while remaining backward-compatible.
Back on topic: I fully support this feature suggestion. It would help greatly in cases where subsequent versions of a commercial package have different licensing, for example a license is valid only for a specific major version (e.g. Resharper - there is currently no way to tell choco "I have a license for 9.x, so please install the latest release before 10.0").
22 remaining items
aaronsteers commentedon Jan 4, 2021
I was directed here to this feature request by some comments regarding python version freezing - and I see that many of the comments here are actually related to python as well. I've logged a new ticket in chocolatey-community/chocolatey-packages#1602 to discuss a reevaluation of granularity for publishing python packages.
This new ticket proposes that we think of "minor" Python version releases as if they were each major releases - adopting a strategy of publishing a new public meta-package for each in the chocolatey package directory starting with
python38. This wouldn't cancel out any capabilities of the existingpythonandpython3packages, but it would simplify version pinning within new major (read: "non-backwards compatible") python release.Would greatly appreciate this group's ideas and combined brain power there in that thread:
RE: chocolatey-community/chocolatey-packages#1602
joel-schaal commentedon Sep 6, 2023
Is there any news around that issue?
I tried it on my side and it still does not work indeed:
In the log file, I was presented with that stack trace:
I looked a bit in
NugetService.Upgradeand I believeNuGetVersion versionshould either be converted to aVersionRange, or the appropriateNuGetVersionshould be looked up (through a find with the appropriate call to the nuget backend), to minimize code change.I just scratched the surface (I'm quite new to the codebase, and not that familiar with C#).
Can someone more versed investigate more thoroughly?
pauby commentedon Sep 6, 2023
This hasn't been assigned to a milestone and isn't something we're working on.
Nuspec versioning doesn't work with the
--versionoption (as you discovered).mvorisek commentedon Nov 22, 2024
Dear developers, this feature request have 40 upvotes, please share the hapiness with us all! 🙏
vbjay commentedon Mar 15, 2025
Problem
I don't want dotnet-windowshosting >8 since 8 is current LTS. If I just
choco upgrade dotnet-windowshosting -y, I would get latest of 9.*Workaround
Can be expanded on to support minor, and build version numbers. Then in your scripting to upgrade do something like below since we can't do range versions like
choco upgrade dotnet-windowshosting --version 8.* -yOR
The problem with this workaround is it makes it harder for us to pass in other arguments to choco. I really want something like
choco upgrade/install --versionand version acceptingGuillaumeHullin commentedon Jul 12, 2025
Inspired by @vbjay but slightly different approach in case that help someone.
Also I agree it would be awesome to have some kind of function to "pin" to major version.
aproposts commentedon Oct 20, 2025
I'm in a similar spot to @GuillaumeHullin and @vbjay. But I'm not sure if the problem would be solved by the proposed solutions, either at the package level as described in the OP for this issue, or the 'pin' level--though they'd both be welcome additions.
What I actually want:
choco upgrade all # with perhaps an option like, --version-safe or --check-dependencies ?...to upgrade packages as per the dependencies of the installed packages (namely metapackages) on the system.
For instance, faced with the same problem as @vbjay, I've uninstalled the
dotnet-windowshostingpackage, instead riding ondotnet-8.0-windowshosting, which solves the top-level 8 vs. 9 problem. Still, the 8.0 metapackage would appear to want to use the previous major version ofdotnet-aspnetcoremodule-v2, andchoco update allwould push it to the next major version.As it is, I'll probably write a wrapper which builds the dependency graph by scraping
.nuspecfiles as demonstrated in #1276 to appropriately decide which packages should actually be updated.Short of having an automagic command switch which 'does the thing', a canonical way to get package dependency metadata would probably be better than reading from disk myself. If I've missed something in the docs, I'm happy to be corrected.