Windows Installer : add option to install MuseScore for all users/single user

• Nov 17, 2015 - 10:04
Reported version
2.1
Type
Functional
Severity
S4 - Minor
Status
active
Project
Tags

See https://musescore.org/en/node/87526

Currently MuseScore is only installed for the current user apparently (?) The MSI should give an option to install for all users or not.

Wix/MSI wizard help is welcome.


Comments

That might sound like a piece of cake but it's not...

We rely on Cmake/Cpack integration with WIX. To sum it up, CPack will generate several WIX files for us, in particular one listing all the files in the installation package. It's very convenient.

Unfortunately, CPack Wix Generator has been designed to work well with the WixUI_InstallDir Dialog Set, and this Dialog Set doesn't provide a Scope Selection UI (that's the name of the feature to select "all users"/"single user") ...

The WixUI_Advanced Dialog Set provides such a UI, but it's not supported by CPack. I cannot find a way to instruct CPack to output the required configuration to use this Dialog Set or to insert a script to do change the output of CPack before calling the Wix toolchain.

So there is no easy solution here I believe. For less easy solution, I can think of:

  • Patch CPack wix generator
  • Don't use CPack at all, a bit similar to what we do for MacOSX, create the WIX files ourself, and call Wix ourselves.

I wonder how other free cmake based software deal with that.

I tried to edit build/packaging/WIX.template.in and it "sort of" works, but I still see some problems.
I changed WixUI_InstallDir to WixUI_Advanced, I removed the WIXUI_INSTALLDIR property and set:
APPLICATIONFOLDER as INSTALL_ROOT
ApplicationFolderName as "$(var.CPACK_PACKAGE_NAME) $(var.CPACK_PACKAGE_VERSION)"
WixAppFolder as WixPerMachineFolder

(I tried this change in master branch)
The installer is created, but:
- it skips the welcome dialog;
- it installs when clicking "Install", requiring administration privileges, but it uninstalls MuseScore 2 and installs MuseScore in %PROGRAM FILES (x86)%/MuseScore 3 (3.0.0 unstable)
- when going to "Advance" and selecting "all users", the prompted folder is called Musescore-3.0.0; when keeping such folder and clicking next, I get msi error 2727
- when going to "Advance" and selecting "just for you", it behaves like the "Install" case

maybe we could add an InstallScopeDlg by inserting it in the InstallDIr UI as described here (section "Inserting a custom dialog into a built-in dialog set"):
http://wixtoolset.org/documentation/manual/v3/wixui/wixui_customization…

OK you went a lot further than I could... I will try it but on 2.1 first.

it uninstalls MuseScore 2 and installs MuseScore in %PROGRAM FILES (x86)%/MuseScore 3 (3.0.0 unstable)
That's normal. For MuseScore 3 we will change both the CPACK_WIX_UPGRADE_GUID and CPACK_WIX_PRODUCT_GUID. For 2.x, we keep CPACK_WIX_UPGRADE_GUID but we change CPACK_WIX_PRODUCT_GUID.

I managed to insert an InstallScopeDlg inside the installation executable.
It seems to work by setting ALLUSERS variable, but I don't know how to test if it really works in my machine. I noticed that I have to use elevated privileges also in the "per user" installation (contrary to what the default button dialogue of InstallScopeDlg says, since I introduced only the change of the ALLUSERS variable and not the change of installation directory).
Attached a diff of what I modified.
If changing only the ALLUSERS variable is enough, we could insert a customized version of this dialogue tab (basically cloning InstallScopeDlg source wxs code), but that would require translations into the different languages.

Attachment Size
diff_ALLUSERS.txt 2.16 KB

After reading about per-user and per-machine installations (and getting more and more confused about the per-user settings), I start to think that maybe the easiest thing is to simply add
<Property Id="ALLUSERS" Value="1"/>
and probably also InstallScope="perMachine" inside the <Package> tag and make the installer a default per-machine installer, since for an installation without elevated privileges in a local folder (which I gather it is basically what a per-user installation does, with additional complications and difficulties of maintenance on top of it) one could rely on the portable version.
Or am I missing something?

The problem I thought we are trying to solve is that we currently install for a single user only. So you need to install MuseScore separately for each user on a shared system, or manually set up desktop shortcuts for them. As far as I am concerned, changing this to install for all users automatically (no option involved) would probably be fine for most people. If you don't use a shared machine, there is no visible difference. And if you do, it's less likely people would complain if it it installed for all users. It's easy enough for other users to delete a desktop shortcut they don't want.

Well, that's *my* opinion anyhow. Would be interesting to get broader feedback - from the MuseScore community at large, also seeing if there are other projects that don't provide the option and checking what they do.

I tried what I was suggesting in comment #9 with MuseScore 2.1-dev: using both the options gives an error since ALLUSERS get defined twice. Using either one or the other creates an installer, which works (requiring elevated privileges).
Unfortunately, such an installer (in both cases) does not perform a disinstallation of previous MuseScore installation and I get two MuseScore (2.0.3 and 2.1) installations.
I think it comes from the fact that in the previous installer the ALLUSERS variable was left as an empty string, and according to this :

There are several common scenarios that an arise when the choice of per-user vs per-machine is given to the user:
1. Major Upgrades can Fail
If you use the Upgrade code feature of Windows Installer to perform a major upgrade the detection of the existing software will fail if: (a) the original software was installed with ALLUSERS="" and the new software has ALLUSERS=1 in its Property table or passed on the command line or (b) the original software was installed with ALLUSERS=1 and the new software has ALLUSERS="" or ALLUSERS is not defined in the Property table or on the command line.

So, does that mean you have to wait for 3.0 to implement this? If so I call that not the end of the world. It can wait.

Again, as far as I understand we are currently installing in Program Files (x86) by default, which is a machine wide install. But we create all the registry keys in HKMU which depending of the value of ALLUSERS will resolve to HKCU (per user install) or HKLM (per machine install).

By default, https://msdn.microsoft.com/en-us/library/windows/desktop/aa367559(v=vs… ALLUSERS="" and the installer will do a per user install since "The recommended default installation context is per-user." and so write in HKCU.

Expert users can set ALLUSERS to 1 if they want to write to HKLM and do a "full" per machine install with MSIEXEC /i MuseScore.msi ALLUSERS="1"

Ah, I think it's a subtlety of terminology that confusing me. Yes, I think it is accurate to say we do a "full" per machine install *if* ALLUSERS is set to 1. I haven';t tried it personally. As an ordinary end user, I don't care so much about registry keys, I just care about whether I get a desktop icon, file associations, etc. I gather that is the *result* of using the proper registry keys. So with ALLUSERS="", we get a machine-wide install location, but the other trappings of installation are for the user only. With ALLUSERS="1", it's supposedly a full machine-wide install, but I haven';t had the opportunity to test if this really meas everyone gets the icon, file associations, etc. I'm kind of going on faith so far.

If all of this is true, and doing the "full" machine-wide install by default is not good because it doesn't replace the old installation, I wonder if we could consider providing two versions of the installer, with one clearly marked as for multi-user installations only and with an explicit advisory to manually uninstall the previous version first? Or provide a one-line batch file that does an install with ALLUSERS="1"?

Which is to say, I'm less concerned that we provide the option within the installer wizard itself than that we at least somehow make it known to interested users that the option exists.

Fwiw I have had very good luck with advanced installer. They do have a free version. I would be willing to take a run at it if ypu cam tell me what else I need besides the program folders...