[wix-users] preventing double installs: per-machine & per-user both getting installed

Alan Sinclair anadem at gmail.com
Thu Mar 15 19:14:05 PDT 2018


Thanks but I don't see how that helps. Apologies if my question wasn't
clear, or if I'm not understanding your reply.

Our customers can choose to install per-user or per-machine (via the
InstallScope dialog as mentioned in my question).

The issue is that the intended-to-be-an-update *second* install isn't
following the same scope as the initial install. If the first install was
per-machine, then it shouldn't be possible for the next install to be
per-user .. I need somehow to enforce the same scope in the update as the
initial install. At present the second install gives the user the regular
InstallScope dialog asking which way to install, whereas it should just be
an update of the same first scope. Or it could uninstall the first scope
and install as chosen in the second install, but it must NOT install both
per-machine and per-user!

Should the install save a reg key saying what it's scope is, which I can
check in a CA then enforce the same scope? Or do a directory search to find
where the installed files are and use that? Or is there a simpler way? Am I
missing some standard way to do this? Any pointers, hints, or comments will
be very helpful.

Thanks
Alan



On Thu, Mar 15, 2018 at 5:13 PM, Wheeler, Blaine (DSHS/DCS) via wix-users <
wix-users at lists.wixtoolset.org> wrote:

> Look at InstallScope to limit installation to Per Machine or Per Person
>
> -----Original Message-----
> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf
> Of Alan Sinclair via wix-users
> Sent: Thursday, March 15, 2018 4:22 PM
> To: WiX Toolset Users Mailing List
> Cc: Alan Sinclair
> Subject: [wix-users] preventing double installs: per-machine & per-user
> both getting installed
>
> 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
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>


More information about the wix-users mailing list