electron-userland / electron-wix-msi

:dvd: Create traditional MSI installers for your Electron app
MIT License
319 stars 93 forks source link

Allow Config of Installscope Instead of ALLUSERS, Burn Bundled Config Flag, and Nested Directory Installation #138

Closed JoeD101 closed 2 years ago

JoeD101 commented 3 years ago

I made multiple changes to fit my needs:

1) Allow Config of Installscope Instead of ALLUSERS

I had to bundle two MSIs together using Burn. One was an electron app and one created in VS with WIX. When bundling, I was getting the following error:

ALLUSERS Property is set to '2' which may change from per-user to per-machine at install time. The Bundle will assume the package is per-machine and will not work correctly if that changes. If possible, remove the Property with Id='ALLUSERS' and use Package/@InstallScope attribute instead.

I noticed there is no simple way to set InstallScope in the wix.xml template. defaultInstallMode seems to not help. I just decided to use defaultInstallMode to set a {{packageScope}} in the XML.

It may be desired to have an individual InstallScope variable, but some way to modify that would be nice.

2) Burn Bundled Config Flag

Another change made was adding a bundled?: boolean configuration flag. I noticed when making an MSIPackage in Burn I couldn't get the Electron-wix-msi created MSI to not show up in programs and features no matter the ARPSYSTEMCOMPONENT or Visible attributes. Bundled just prevents it from being added as a registry entry, so if bundled: true and it is installed on its own, it won't have a way to be uninstalled via programs and features but will automatically if used in a Burn bundle with its own entry.

3) Nested Directory Installations

If the MSI is to be installed in a directory with other applications also already installed inside the directory, it would overwrite all of the other applications in that directory when upgradeCode is set (upgradeCode would need to be set if the MSI is continually rebuilt and pushed out with updates to overwrite and not save old versions of the app). To allow a nested installation in this scenario, the flag nestedFolderName?: string was added. When set, the programFilesFolderName will be a level below nestedFolderName so not to disturb other contents in nestedFolderName on updates with upgradeCode set to a constant. If nestedFolderName does not exist, it will still create it on installation. The way in which this was implemented using indents may not be desirable, but the end result could be a good feature.

bitdisaster commented 2 years ago

Sadly the changes in Installscope broke all the perUser E2E tests. Installing the MSI with MSIINSTALLPERUSER=1 no longer installs it in the user context.