Closed afroewis closed 2 months ago
choco install foo-cc --source 'C:\temp\bad1' -Y --force -d
You mentioned that the package is in the C:\temp\bad
folder. But you specified the source as C:\temp\bad1
?
Sorry, that was a typo when writing the issue. In my extensive tests, the correct directory was used. I will edit my issue to remove this confusion.
I can't reproduce the issue here (note there are no issues with having '-' in the package name):
Note that my package above is empty and doesn't have any Chocolatey scripts. Can you provide your package?
Thanks for your efforts so far. Did you use filename that contains dots (like foo-cc.24.5.24095.5.nupkg
?)
I can't provide my package (secret stuff), but I will try to reproduce it with an empty package this weekend!
The dots are the version number. The filename of the package was foo-cc.24.5.24095.5.nupkg
.
I tried to reproduce the problem but didn't succeed. When renaming the file, the installation still fails. That's weird. I am convinced it was that way.
However, I looked more into this issue and I found out that my problem is related to the version of the package.
I have two files:
First, I install version 1.2.0 without any problems:
choco install ClassLibrary1 --source "C:\temp\foo" -f -y
Then, I try to install version 1.3.0:
choco install ClassLibrary1 --source "C:\temp\<path-to-1-3>" -f -y
Output:
choco install ClassLibrary1 --source "C:\temp\foo" -f -y
Chocolatey v2.2.2
Installing the following packages:
ClassLibrary1
By installing, you accept licenses for the packages.
ClassLibrary1 v1.2.0 already installed. Forcing reinstall of version '1.2.0'.
Please use upgrade if you meant to upgrade to a new version.
ClassLibrary1 not installed. The package was not found with the source(s) listed.
My expectation was that when using --force
, it will install the package in the folder, even though a different version of it is already installed.
What happens when you do what the message suggests and use upgrade
?
--force
installs the same version again in this case. Note that using --force
is not recommended as, as this case demonstrates, it will not do what you think.
When using upgrade, it upgrades the package if the version in the source folder is newer than the installed one.
I also noticed that the installation works if I provide the version with --version
. With this switch, I can even install older versions.
I guess I just shouldn't use --force. Thanks for your help.
I can even install older versions.
Note that you need to add --allow-downgrade
to install older versions over a new version.
Checklist
What You Are Seeing?
What is Expected?
I expect the chocolate to find and install the package
How Did You Get This To Happen?
I am installing a package from a local source.
foo-cc.24.5.24095.5.nupkg
foo-cc
C:\temp\bad
(it only contains the nupkg file)My command;
choco install foo-cc --source 'C:\temp\bad' -Y --force
When I rename
foo-cc.24.5.24095.5.nupkg
tofoo.nupkg
, the installation works. Is this behavior intended?System Details
Installed Packages
Output Log
Additional Context
No response