I'm trying to create an installer that supports perUser and perMachine installations dependent on a selection of setup types on the UI.
My attempt was to initially set the Package/@InstallScope to perUser and then modify the ALLUSERS property later on.
If the user selects the perMachine setup type I'm trying to set the ALLUSERS property to 1 doing the following:
<Publish Property="ALLUSERS" Value="1">1</Publish>
The "Install" buttons gets an UAC icon, but no UAC dialog appears after I pressed it!
Instead I get an error message that I obviously have no privileges to install the application for all users of the machine.
Is it a bug that no UAC dialog appears or intended? Am I missing something?
Someone from the WiX Mailing list pointed me to the Single Package Authoring article on msdn.
I had to initialize the following properties:
<Property Id='ALLUSERS' Value='2' />
<Property Id='MSIINSTALLPERUSER' Value='1' />
and set the 'MSIINSTALLPERUSER' property to an empty string for a per-Machine installation.
<Publish Property="MSIINSTALLPERUSER" Value="{}">1</Publish>
Be aware that this only works for Windows Installer 5 and higher!