Reputation: 10402
I have an app with a WiX installer with the standard Just Me/All users option which sets the ALLUSERS property.
When I install with "Just Me" option and then install a later version of the app with the same "Just Me" option, it apparently does not detect the old version of the app, and duplicates the entry in Add/Remove programs (and every subsequent version will create its own entry in Add/Remove programs).
This never happens when I select "Install for all users" option - in that case the old version is removed.
This is the InstallExecuteSequence:
<InstallExecuteSequence>
<!-- Only schedule this custom action for the 32-bit MSI. -->
<?if $(var.DependenciesPlatform)=x86 ?>
<Custom Action="CA_Err32BitMsiOn64BitOS" After="LaunchConditions">
<![CDATA[MsiAMD64 OR Intel64]]>
</Custom>
<?endif ?>
<Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
<RemoveExistingProducts Sequence="1" />
<Custom Action="LaunchApp" After="InstallFinalize" />
<InstallInitialize></InstallInitialize>
<RemoveShortcuts></RemoveShortcuts>
<InstallFiles></InstallFiles>
<CreateShortcuts></CreateShortcuts>
<InstallFinalize></InstallFinalize>
<ScheduleReboot After="InstallFinalize"/>
</InstallExecuteSequence>
I also have this Upgrade element:
<Upgrade Id="$(var.UpgradeCode)">
<!-- Detect any newer version of this product -->
<UpgradeVersion Minimum="$(var.Version)" IncludeMinimum="no" OnlyDetect="yes" Property="NEWPRODUCTFOUND"/>
<!-- Detect and remove any older version of this product -->
<UpgradeVersion Maximum="$(var.Version)" IncludeMaximum="yes" OnlyDetect="no" Property="OLDPRODUCTFOUND"/>
</Upgrade>
The package and Product Id is set to ????-...??
<Package Id="????????-????-????-????-????????????"
InstallerVersion="200"
Compressed="$(var.Compressed)"
InstallPrivileges="elevated"
/>
<Product Id="????????-????-????-????-????????????"
Name="$(var.ProductFullName)"
Language="$(loc.LANG)"
Codepage="1250"
Version="$(var.Version)"
Manufacturer="Company"
UpgradeCode="$(var.UpgradeCode)"
>
UpgradeCode is constant.
This is how the ALLUSERS property is specified:
<Publish Property="ALLUSERS" Value="{}"><![CDATA[FolderForm_AllUsers="ME" AND VersionNT>=400 AND Privileged=1 AND FolderForm_AllUsersVisible=1]]></Publish>
I ran msiexec with /i /l*vx option, but I have not found anything relevant in the log.
ALLUSERS property is deleted - can this be the reason? I assume it is because of the Publish element, since when I change the Value to e.g. 1, it does not delete the property.
MSI (c) (5C:E4) [10:15:14:807]: PROPERTY CHANGE: Deleting ALLUSERS property. Its current value is '1'.
RemoveExistingProducts is executed, but does not report anything:
MSI (s) (54:E4) [17:01:22:095]: Running ExecuteSequence
MSI (s) (54:E4) [17:01:22:095]: Doing action: RemoveExistingProducts
MSI (s) (54:E4) [17:01:22:095]: Note: 1: 2205 2: 3: ActionText
Action 17:01:22: RemoveExistingProducts. Removing applications
Action start 17:01:22: RemoveExistingProducts.
Action ended 17:01:22: RemoveExistingProducts. Return value 1.
Why is the old version not removed when "Only Me" option is selected?
WiX 2.0.5805, unfortunately I cannot upgrade to a newer version of WiX at this time
Upvotes: 1
Views: 2048
Reputation: 10402
Further debugging has shown the source of the problem: FindRelatedProducts reported that current install is per-machine.
MSI (c) (60:B8) [14:53:00:996]: FindRelatedProducts: current install is per-machine. Related install for product '<>' is per-user. Skipping...
The ALLUSERS property is modified only after FindRelatedProducts (from the same installation, note timestamp).
MSI (c) (60:14) [14:53:05:885]: PROPERTY CHANGE: Deleting ALLUSERS property. Its current value is '1'.
The problem was that ALLUSERS was pre-set earlier in the script.
<Property Id="ALLUSERS" Secure="yes">1</Property>
It was probably left int the WiX script when someone else was trying to force per-machine installation in the past.
Removing the line fixed the issue.
Upvotes: 0
Reputation: 42236
Check this KDB entry from Installshield: http://helpnet.installshield.com/installshield17helplib/IHelpISSetAllUsers.htm
Extraxt: "...The new installation’s ALLUSERS property must match the installed version’s property in order for the FindRelatedProducts action to succeed for the upgrade installation. In addition, if the previous version is installed for only one particular user and the upgrade is installed for all users, the resulting installation is corrupted and might not uninstall properly. ISSetAllUsers eliminates these problems by resetting the ALLUSERS property."
I am not aware of an equivalent built-in feature in Wix, but you should be able to make your own custom action to check this without too much hassle.
Upvotes: 0
Reputation: 20790
You should probably post the log anyway in case more sets of eyes detect something relevant. FindRelatedProducts is often the place to look to see if it detected a prior version.
In general this works, and you need something like the majorupgrade element in your WiX to provide the framework - it doesn't happen by default. The UpgradeCode must be the same as the original setup, the ProductCode different, the ProductVersion incremented in the first 3 digits.
Upvotes: 1