-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
-l,--location
option not working on all msi packages
#1857
Comments
Sooo i learned something today in microsoft/winget-pkgs#41913 (comment) winget-cli/src/AppInstallerCommonCore/Manifest/ManifestCommon.cpp Lines 451 to 481 in b79e408
And from my understand winget-cli uses the same switches for burn, wix and msi, if someone could double check the InstallerSwitches for burn and wix we over at the winget-pkgs could fix the InstallerTypes cc @ItzLevvie @jedieaston @Trenly @denelon winget-pkgs progress: https://github.com/microsoft/winget-pkgs/search?p=1&q=InstallerType%3A+wix&type=code |
Apparently they should be the same? |
It looks like WiX doesn't have a standard argument for install location, but by convention people use INSTALLLOCATION? https://stackoverflow.com/questions/24266720/how-to-define-installation-folder-from-command-line-parameter-in-wix-installer If we add |
Just my 2 cents. WiX has always used something different than TARGETDIR. The reason is that WiX actually does it "wrong" (or at least: their advertised examples). The MSI specs are very clear: TARGETDIR is to be used if you want the non-standard installation folder. See: https://docs.microsoft.com/en-us/windows/win32/msi/targetdir (first paragraph). To accomplish this, a MSI should set the TARGETDIR property if and only if it is not set by the user. Something like (pseudo code):
This is clear from https://docs.microsoft.com/en-us/windows/win32/msi/using-the-directory-table. This can be easily accomplished in WiX as well, by a Most WiX examples use:
The problem is that even if you override TARGETDIR, the next "child directory" (note: that is not the same as a subdirectory) immediately get set to %ProgramFiles64Folder%, as that is a predefined property. As a result, the TARGETDIR gets completely ignored and everything ends up below %ProgramFiles64Folder% again. Unless you override the very last directory in this list. In the example above that would be APPLICATIONFOLDER. That is what current WiX examples use: https://wixtoolset.org//documentation/manual/v3/wixui/dialog_reference/wixui_advanced.html. But in the past, it has been INSTALLLOCATION. And in fact, it could be anything. Even worse: if the Id of the final destination directory is not spelled in ALL-CAPPS, then you cannot even override it at all. To be clear, the above example should read:
but (again): nobody actually does this. ADDED: |
How the
In other words, this is not an issue with the client, but rather an issue with incomplete manifest files. |
winget-cli/src/AppInstallerCommonCore/Manifest/ManifestCommon.cpp Lines 477 to 509 in 5d63c38
This is the reason why not all MSI and WIX manifests in the winget-pkgs repository have it. It's also the same with It does look like some installers work a bit differently so the snippet of code above will need a bit of adjustments. This is down to the differences between WIX and MSI noted in #1857 (comment) which is why the PuTTY manually declares Also the |
@ItzLevvie I'd still consider this an issue better addressed by modifying the manifest files. It's certainly not a bug (as this issue is labled) if winget does not implicitly pickup on non-standard switches implemented by developers. Especially if that can be worked around with a properly defined manifest file. |
Some MSI files like Zeal are using I am not sure if this is a standard property, but it seems there are more applications using it. |
Brief description of your issue
This issue is a followup on my PR for a package mainfest.
There seem to be a lot of inconsistencyes on how to set the install location path for msi packages. The code currently sets the
TARGETDIR
option.winget-cli/src/AppInstallerCommonCore/Manifest/ManifestCommon.cpp
Line 461 in b79e408
This is only one of two available options (see here) and some packages seem to require the alternative
INSTALLDIR
option.I have tested the packages
Oracle.JDK.17
,StrawberryPerl.StrawberryPerl
andChristianHohnstadt.xca
, which all currently don't work with the-l
switch.In contrast to that, the
Borvid.HttpMasterExpress
package works absoloutly fine as is.One possible soloution would be to allways pass both of these options, which worked in my short testing.
Steps to reproduce
Use one of the following commands:
winget install Oracle.JDK.17 -l C:\ProgStuff\jdk
winget install Oracle.JDK.17 -l "C:\ProgStuff\jdk"
winget install Oracle.JDK.17 --override "/passive TARGETDIR=C:\ProgStuff\jdk"
The jdk is now installed into
C:\Program Files\Java\jdk17
and NOT into the given location.Only
winget install Oracle.JDK.17 --override "/passive INSTALLDIR=C:\ProgStuff\jdk"
works as expected.Expected behavior
The package should be installed into the given Path.
Actual behavior
The given directory is ignored and the package is installed into the default directory.
Environment
The text was updated successfully, but these errors were encountered: