I was poking through my email this morning while waiting for a couple long running processes to complete, when an email popped in pointing me to a Stackoverflow question. Typically, I redirect such inquiries to my support page. But it was a slow day at FireGiant Support so I thought I'd take a look.
The Stackoverflow question was worded a bit alarmingly "Windows Installer just changes my installation to ALLUSERS=1 behind my back" but provided all the necessary code to understand what they were attempting to accomplish. The log file snippet showed the repro:
... MSI (c) (B0:B4) [18:08:08:543]: PROPERTY CHANGE: Modifying ALLUSERS property. Its current value is '0'. Its new value: '1'.
At first, I was a bit disappointed the immediate lines above the issue were truncated. Why? Well, my first guess was that an errant custom action was messing things up. 93.33% of the time, when something is failing it's a custom actions fault.
But something about the code looked funny. I could see they wanted a per-user installation (called out very clearly in the question and code) but this caught my eye:
<Property Id="ALLUSERS" Value="0"/>
- An ALLUSERS property value of 1 specifies the per-machine installation context.
- An ALLUSERS property value of an empty string ("") specifies the per-user installation context.
- If the value of the ALLUSERS property is set to 2, the Windows Installer always resets the value of the ALLUSERS property to 1 and performs a per-machine installation or it resets the value of the ALLUSERS property to an empty string ("") and performs a per-user installation. The value ALLUSERS=2 enables the system to reset the value of ALLUSERS, and the installation context, dependent upon the user's privileges and the version of Windows.
Do you see the issue? More importantly do you see what is missing? Yeah,
there's no mention of
0. So what is the behavior when ALLUSERS=0? I
summed it up this way in my answer:
The value "0" is undefined so you get whatever undefined behavior the Windows Installer picks this (pick one of the following): week/month/year/operating system/service pack.
Yes, I was trying to be funny. No, I don't know if I was successful. Anyway,
the net net is that setting
ALLUSERS=0 will get you unexpected
(aka: undefined) (aka: screwy) behavior. Uhh, don't do that.
So, how would one use the WiX toolset to create a per-user installation package? It goes a bit like this:
<Package InstallScope="perUser" />
That's it. You can't explicitly define properties in an MSI to blank
so to define a property to blank you don't include it at all. In other
words, don't add a Property named
Anyway, there's the story behind my first StackOverflow answer in a long time. If you wish you could get immediate, detailed answers to your Windows installer and/or WiX toolset questions then checkout FireGiant Support. Quick and complete answers without any of the snark you might find here. :)
In the meantime, keep coding. You know I am.