[wix-users] preventing double installs: per-machine & per-user both getting installed
Alan Sinclair
anadem at gmail.com
Thu Mar 15 16:21:41 PDT 2018
If I first install my package per-machine, then install the next version
per-user, I'm ending up with both sets installed. How can I prevent this?
Do I need some DLL custom action code to check for existing package
installed in the other scope?
I thought that FindRelatedProducts would recognize the first package and
turn the second install into an upgrade, but that's not happening. The log
shows this:
MSI (c) (7C:58) [15:45:55:699]: FindRelatedProducts: current install is
per-user. Related install for product
'{01855CFB-CD94-4046-B41A-60E1F7DC1325}' is per-machine. Skipping...
Here's my code
<Product Id='*' UpgradeCode='AC9825C9-8164-4A7A-B575-FA557EED9A4C'
Name="!(loc.ApplicationName)" Manufacturer='!(loc.ManufacturerName)'
Version="$(env.PRODUCT_VERSION_DOTTED)" Language='1033'
Codepage='1252' >
<Package Id='*'
Manufacturer='!(loc.ManufacturerName)'
Platform="$(var.V_PLATFORM)"
InstallerVersion='300' Languages='1033' Compressed='yes'
SummaryCodepage='1252' />
<Upgrade Id='AC9825C9-8164-4A7A-B575-FA557EED9A4C'>
<UpgradeVersion OnlyDetect="yes"
Minimum="$(env.PRODUCT_VERSION_DOTTED)"
Property="NEWERVERSIONDETECTED" IncludeMinimum="no" />
<UpgradeVersion OnlyDetect="no"
Maximum="$(env.PRODUCT_VERSION_DOTTED)"
Property="OLDERVERSIONBEINGUPGRADED" IncludeMaximum="no" />
</Upgrade>
<InstallExecuteSequence>
<!-- block downgrades for silent installs -->
<Custom Action='PreventDowngrading' After='FindRelatedProducts'>
NEWERVERSIONDETECTED
</Custom>
<!-- remove old packages -->
<RemoveExistingProducts Before='InstallInitialize'/>
</InstallExecuteSequence>
<InstallUISequence>
<!-- when running with UI block downgrades before the Welcome
screen appears -->
<Custom Action='PreventDowngrading' After='FindRelatedProducts'>
NEWERVERSIONDETECTED
</Custom>
</InstallUISequence>
<CustomAction Id='PreventDowngrading' Error='!(loc.PreventDownMsg)'
/>
<Directory Id='TARGETDIR' Name='SourceDir'>
[etc.]
Any suggestions will be much appreciated!
Incidentally, I'm not using the MajorUpgrade element because when I do so I
cannot sequence RemoveExistingProducts, which I must have to uninstall a
different package .. an older MSI with different UpgradeCode, using this
code:
<Upgrade Id="A2344ED4-1A07-9AAE-78AE-0A1BCD932E37">
<UpgradeVersion OnlyDetect="no"
Property="PREWIX_PACKAGE_FOUND" Minimum="0.0.0" />
</Upgrade>
Thanks
Alan
More information about the wix-users
mailing list