TL;DR: I cannot get the %ProgramFiles% to %LocalAppData%\Programs folder redirection documented by Microsoft by simply ensuring that the ALLUSERS property is empty.
Is that folder redirection only achievable in dual-purpose packages by setting ALLUSERS=2 and MSIINSTALLPERUSER=1, and does that mean that Microsoft's documentation on installation context is wrong?
I'm using Wix v4 to create an installer based on Windows Installer technology. The installer must not require elevated privileges and therefore install the application for the current user only, not all users.
According to Microsoft's documentation, I can point my installation location to ProgramFiles64 and, if I did not set the ALLUSERS property, it will automatically redirect the folder to a standard user-writable location, which has been %LocalAppData%\Programs since at least Windows 7.
The equivalent of that is to user the perUser scope in WiX, which will not set ALLUSERS (and also disable privilege escalation).
This is what my test package looks like:
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Package Name="Contoso App" Manufacturer="Contoso" Version="$(ProductVersion)" UpgradeCode="a58f9a69-c688-46f1-8c8e-eb225060c61c" Scope="perUser">
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
<MediaTemplate EmbedCab="yes" />
<StandardDirectory Id="ProgramFiles64Folder">
<Directory Id="INSTALLFOLDER" Name="!(bind.Property.ProductName)" />
</StandardDirectory>
<ComponentGroup Id="ExampleComponents" Directory="INSTALLFOLDER">
<Component>
<File Id="ContosoApp.exe" Source="$(env.USERPROFILE)\ContosoApp\bin\ContosoApp.exe" />
</Component>
</ComponentGroup>
<Feature Id="Main">
<ComponentGroupRef Id="ExampleComponents" />
</Feature>
</Package>
</Wix>
Unfortunately, the installer compiled from that tries to install to C:\Program Files\Contoso App and not C:\Users\<username>\AppData\Local\Programs\Contoso App
If I change the scope to perUserOrMachine, then I get the redirection.
That's also equivalent to adding this to the above example within the <Package> element:
<Property Id="ALLUSERS" Secure="yes" Value="2" />
<Property Id="MSIINSTALLPERUSER" Secure="yes" Value="1" />
But I'm not really looking to create a dual-purpose package as Microsoft calls them. I just want a single-purpose one that only ever installs per user and can never ask for privilege escalation.
Am I missing something?