Skip to content

MSI installer ignores selected target folder #703

Closed

Description

@igorakkerman

Describe the bug

The MSI installer for Windows 10 x64

  1. suggests a wrong install folder (x86 instead of x64)
  2. ignores different install folder when changed by user

Tested with installer for 0.6.2:
https://github.com/cli/cli/releases/download/v0.6.2/gh_0.6.2_windows_amd64.msi

Steps to reproduce the behavior

  1. Launch .msi install file on Windows 10 x64.
  2. See default install location: C:\Program Files (x86)\GitHub CLI (error 1)
  3. Change install location to: C:\Program Files\GitHub CLI
  4. Finish the install process.
  5. See application installed in: C:\Program Files (x86)\GitHub CLI (error 2)

Expected vs actual behavior

  1. Default install location to be: C:\Program Files\GitHub CLI
  2. User changes to install location to be reflected

Activity

  1. added
    bug
    on Mar 26, 2020
  2. mislav commented on Mar 26, 2020

    @mislav
    Contributor

    Thank you for reporting, and nice catch! I must admit I haven't tried changing the installation path when we initially tested the installer.

    Our Windows release process is powered by go-msi, which in turn invokes WiX Toolset to create the MSI installer. So I suspect the bug with the changed path not being respected is in one of these projects.

    The bug with amd64 binary defaulting to C:\Program Files (x86) is most likely a separate issue and might come down to a configuration problem.

    We will look into this when we have a chance! If there is in the meantime a Windows person experienced with WiX who would like to take a look at this, please be our guest 🙇

  3. added
    windows
    on Mar 26, 2020
  4. igorakkerman commented on Mar 26, 2020

    @igorakkerman
    Author

    Thanks, I just noticed that my original report listed wrong paths all over, fixed this now. I've looked into both go-msi and WiX prior to opening this issue but wasn't able to find any similar problems on their sides. Maybe someone else knows more :-)

  5. darkred commented on Sep 16, 2020

    @darkred

    Just wanted to report that both issues of the OP are still present in today's first out of beta release 1.0.0 .
    I'm sure the devs have this issue in mind,
    it's just that those, like me, that install the first non beta version of GitHub CLI via gh_1.0.0_windows_amd64.msi ,
    get the wrong impression that the installed gh.exe is a x86 binary.

  6. added
    priority-2
    on Sep 30, 2020
  7. Grrrrrrrrrrrrrrrr commented on Jan 11, 2021

    @Grrrrrrrrrrrrrrrr

    I am also having both these issues with the gh_1.4.0_windows_amd64.msi installer.

  8. aravindvnair99 commented on Feb 19, 2021

    @aravindvnair99

    I am also having both these issues with the gh_1.4.0_windows_amd64.msi installer.

    Continues in v1.6.1 as well.

  9. mislav commented on Feb 22, 2021

    @mislav
    Contributor

    Thanks for reporting, all. This is still an ongoing issue, as evident by this ticket still being open. We appreciate your patience while we address this.

  10. bchadwic commented on Jul 2, 2021

    @bchadwic
    Contributor

    Not sure if this helps or not, but I installed gh_1.12.1_windows_amd64.msi on my personal and work computer in two alternative separate locations and the MSI worked as intended.

  11. darkred commented on Jul 2, 2021

    @darkred

    in two alternative separate locations and the MSI worked as intended.

    You mean locations different than Program Files and Program Files (x86), e.g. C:\.
    Yes, I confirm that.


    Because the OP still stands.
    Using win10 x64 21H1, I just (uninstalled v1.12.0 x64 and) tried to install gh_1.12.1_windows_amd64.msi :

    • The default install location was still wrong, C:\Program Files (x86)\GitHub CLI (error 1)
    • And, even if I set it to C:\Program Files\GitHub CLI, it installed it: C:\Program Files (x86)\GitHub CLI (error 2).
  12. bchadwic commented on Jul 3, 2021

    @bchadwic
    Contributor

    Because the OP still stands.
    Using win10 x64 21H1, I just (uninstalled v1.12.0 x64 and) tried to install gh_1.12.1_windows_amd64.msi :

    • The default install location was still wrong, C:\Program Files (x86)\GitHub CLI (error 1)
    • And, even if I set it to C:\Program Files\GitHub CLI, it installed it: C:\Program Files (x86)\GitHub CLI (error 2).

    My apologies, I didn't test for that. Yeah that happens for me too. Default location is x86 on a win10 x64, and I can't successfully change it to Program Files. I'd like to look into this.

  13. mislav commented on Aug 16, 2021

    @mislav
    Contributor

    @bchadwic The problem is in go-msi: https://github.com/mh-cbon/go-msi/blob/7f05345d485bba45400e3d82d46eaa067b47d652/templates/product.wxs#L3-L6

    These directives switch between Program Files (x86) and Program Files. However, the resulting MSI will always be created with Program Files (x86), even on a 64-bit system, due to the fact that it fails to call candle (a utility that's part of the WiX toolset) with the -arch x64 flag, and as a result always producing the installer that's hardcoded for 32-bit systems.

    It's a pretty deep problem and I think fixing that and related other MSI issues will require us to stop using go-msi and perhaps write XML by hand and interface with WiX Toolset directly.

  14. bchadwic commented on Aug 17, 2021

    @bchadwic
    Contributor

    @mislav

    I'm not sure how attached you all are to the WiX toolset but I built a inno setup installer tonight and I think it may solve a few of the MSI issues posted.

    New features over the existing installer (correct me if I'm wrong):

    • allows user to decide if gh should be installed local to the current user or to the system (based on admin privileges)
    • executable is installed in the specified location
    • back buttons work
    • features neat github icon :)

    Things that need to be added to the new installer:

    • agree to terms check box / script
    • signed releases

    if this is something that might interest the team, let me know and I'll continue to work on it.

    https://github.com/bchadwic/gh-installer

  15. 8 remaining items

  16. bchadwic commented on Aug 23, 2021

    @bchadwic
    Contributor

    Given we're dealing with GitHub users, that is, developers, this should be a very minor issue ;)

    @igorakkerman fair, however no one likes extra steps considering wix might not be all that bad.

    I think I'll go ahead and finish out the inno setup prototype, which would include a licensing page, an automation shell script, and the feature that would uninstall a <1.14.x version if it is found on the system. Then I'll tag mislav to maybe get a better opinion on the subject

  17. heaths commented on Aug 25, 2021

    @heaths
    Contributor

    I was a developer on WiX for many years and dealt with internal Windows Installer support for many more. The problem is that the MSI is built for x86 and ProgramFilesFolder will always be the x86 path even if you specify another directory because it gets redirected back. You need separate installers for x86 and x64, unfortunately.

    I can fix this so that the MSI is always x64, but I'm wondering if x86 support is even needed. I see it's in the general Windows support issue, so I'm assuming so. Fortunately, the winget package manifest schema can support both x86 and x64 so anyone using that will get the right one automatically.

    MSI (c) (3C:C4) [23:05:00:167]: PROPERTY CHANGE: Modifying INSTALLDIR property. Its current value is 'C:\Program Files (x86)\GitHub CLI\'. Its new value: 'C:\Program Files\GitHub CLI\'.
    MSI (c) (3C:C4) [23:05:00:236]: WIN64DUALFOLDERS: 'C:\Program Files (x86)\' will substitute 17 characters in 'C:\Program Files\GitHub CLI\' folder path. (mask argument = 0, the folder pair's iSwapAttrib member = 0).
    MSI (c) (3C:C4) [23:05:00:236]: In SetTargetPath, re-mapping 'C:\Program Files\GitHub CLI\' to 'C:\Program Files (x86)\GitHub CLI\' because this is a 32-bit package being installed on Win64.
    

    To add, an x64 MSI can install to both 32- and 64-bit locations, but will fall to install at all on an x86 OS.

  18. mislav commented on Aug 25, 2021

    @mislav
    Contributor

    @heaths It's great to hear you have WiX experience! I would love it if we could get to a point where we're generating separate MSI installers for x86 and x64. Then, the x64 installer could default to C:\Program Files instead of C:\Program Files (x86).

    The tricky part is, right now every x64 Windows user has GitHub CLI installed to C:\Program Files (x86)\GitHub CLI because our installer is busted and they couldn't have changed the directory even if they tried. When we publish a fixed MSI installer for those platform, what should we do with the old directory? Should we have some explicit instructions in WiX XML files to clean up that directory if one is detected? Or is the process of upgrading the GitHub CLI version through MSI always going to clean up the previous version automatically?

    Second, what is the best way to enable the user to choose their install location for GitHub CLI and have it be remembered between upgrades? Is that done by writing a registry entry? We don't do that right now, but I think it would be necessary if we fix choosing the install location. No sense in being forced to choose the same install location over and over on every manual upgrade.

    To drop our dependence to now-unmaintained go-msi, I've tried manually rolling a WiX XML file for the hub project, with intention to use this approach in GitHub CLI as well, but I got stuck somewhere and I don't remember where: https://github.com/github/hub/blob/windows-msi/script/windows-msi.wxs.tmpl

  19. heaths commented on Aug 25, 2021

    @heaths
    Contributor

    Cleaning up the old install is easy. You just schedule RemoveExistingProducts before InstallInitialize. There's some other nuance I'd be happy to author including remembering the install location. Not sure if the current solution building the MSI will support that, but if needs be I can author a project and ask the support necessary. The build environment can be downloaded from NuGet, though I believe windows-latest includes a recent WiX install anyway.

    For now, it's just an x64 binary, correct? Or are you building an x86 as well? The x64 MSI could install both. An x86 MSI can also be used to support ARM64 but if a native ARM64 binary is desirable, that will need to be a separate MSI still. I've been working with both the PowerShell team and my old team, the Visual Studio Installer team, on similar solutions.

  20. mislav commented on Aug 25, 2021

    @mislav
    Contributor

    For now, it's just an x64 binary, correct? Or are you building an x86 as well? The x64 MSI could install both.

    What do you mean? Are you suggesting that we publish a single x64 MSI that contains gh.exe binaries for both architectures and is installable on 32-bit Windows?

    Not sure if the current solution building the MSI will support that, but if needs be I can author a project and ask the support necessary.

    No, as I said, we'd have to drop go-msi from our release automation (it's a project that wraps creating WiX XML files and calling the WiX Toolset on it), so I was thinking of rolling an XML file by hand in a separate branch and inviting you to take a look at/collaborate on it.

    though I believe windows-latest includes a recent WiX install anyway.

    Yeah, we'd just call candle and light in a GitHub Actions job on Windows.

  21. heaths commented on Aug 25, 2021

    @heaths
    Contributor

    No, an x64 MSI cannot install on x86. It can install binaries for both architectures, though. A separate MSI is needed for x86.

    The key is fragments and not authoring component GUIDs. In most cases, the auto-GUIDing feature work correctly and avoid costly and confusing behaviors.

    I recommend using a .wixproj and running MSBuils on that. Running candle and light - especially when multiple source files world be easier to manage - is doable but unnecessary. Projects make it easier, as well as adding in extensions out building chainers. For example, of you built a bundle, the x64 and/or x86 MSIs could be installed automatically based on the target system. Projects allow you to specify dependencies, infer build order, and even reference project variables in other projects.

  22. heaths commented on Aug 25, 2021

    @heaths
    Contributor

    For context, here's a recent one waiting on a final review (review is vacationing but back soon): PowerShell/openssh-portable#521. It can produce both an x86- and x64-only MSI, though there's no current plans for x86 (but may be later, hence the support now). For an EXE, having both x86 and x64 doesn't really make sense and does make the authoring easier where you only have to condition whether to use ProgramFilesFolder or ProgramFiles64Folder to use in the default path, and the UpgradeCode. The rest of the authoring can pretty much be the same. The <Environment> to augment the PATH should be put into the same component as the sole gh.exe since it's a versioned file and will auto-GUID correctly.

    The x86 and x64 MSIs should probably be mutually exclusive and there's a way to do that. That way, you don't have both in the PATH. I suppose there's probably nothing terribly wrong with that, though.

    If you wanted to start with some source - where you'd want it, etc. - I'd be happy to contribute some authoring with comments as to why, or can start from scratch myself and contribute a PR.

  23. igorakkerman commented on Aug 31, 2021

    @igorakkerman
    Author

    I wonder how likely it is that this tool is or will ever be used on x86 and if the effort of spending resources on an x86 build/installer is worth it. IMO there might be a few exceptional cases of developers depending on x86 but is the ability to use this tool really crucial for them?

  24. heaths commented on Aug 31, 2021

    @heaths
    Contributor

    It's really not much effort at all. Like I did with PowerShell, a couple variables for a different UpgradeCode and architecture setting and the authoring can otherwise be the exact same source. That said, I agree support for x86 may be dubious, but if the CLI wants to support Windows 7 there were still quite a few customers (maybe not dev customers though) on x86.

  25. heaths commented on Aug 31, 2021

    @heaths
    Contributor

    @mislav if you'd prefer, I can start on authoring and submit a PR to collaborate on.

  26. mislav commented on Sep 1, 2021

    @mislav
    Contributor

    @heaths That would be awesome, thank you. 🙇

    To be honest, since your previous comment I was looking a bit into wixproj files and MSBuild, but having no experience with either and online guides suggesting I should use Visual Studio for all this, I think I was way in over my head.

  27. heaths commented on Sep 1, 2021

    @heaths
    Contributor

    Sure thing. Not blocking (we can always move it), but if you have some thought as to where to put the files. I will update the workflow to invoke it as well.

  28. mislav commented on Sep 2, 2021

    @mislav
    Contributor

    Feel free to put build stuff under script/. Also, our current release workflow is triggered by git tags, but in the interest of testing this Windows stuff in Actions without having to push new git tags, you could temporarily configure the Windows build workflow to be triggered on push or on workflow_dispatch.

  29. added a commit that references this issue on Sep 5, 2021
    5fad092
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpackagingpriority-2windows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions