The MSI team recommend that you create separate MSIs for per-user and
per-machine because they are hard to create correctly. If you are using only
MSI v5, there is better support for dual-purpose packages.
http://msdn.microsoft.com/en-us/library/dd408068%28VS.85%29.aspx

The log entry tells you that your installation does not have the same context
as the old version - a per-machine installer cannot upgrade a per-user
installation and vice versa. Products like InstallShield use an
early-scheduled custom action to detect installed products and, if an old
version is found, sets ALLUSERS to the correct value before the rest of the
installation proceeds. The dialog is also disabled in this case.

There's sample code for such a custom action in this thread
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/detecting-previ
ous-version-s-ALLUSERS-property-td695163.html#a695164


-----Original Message-----
From: Sergey [mailto:sh0...@gmail.com] 
Sent: 07 December 2011 06:06
To: General discussion for Windows Installer XML toolset.
Subject: [WiX-users] major update which must uninstall previous installations
with support of selection per user/per machine

Hello,

I have WIX project for product, which needs updates periodically.
Also I block downgrade installations.
There is a dialog in WIX, which allows to select between per user/per 
machine installation.

Uninstall previous installations is handled using "Upgrade" table:
>     <Upgrade Id="$(var.UpgradeCode)">
>       <UpgradeVersion Property="OLDAPPFOUND"
>                       Minimum="1.0.0.0" IncludeMinimum="yes"
>                       Maximum="$(var.version)" IncludeMaximum="no"
>                       OnlyDetect="no" />
>       <UpgradeVersion Property="NEWAPPFOUND"
>                       Minimum="$(var.version)" IncludeMinimum="no"
>                       OnlyDetect="yes"/>
>     </Upgrade>


Sequences:
>     <AdminExecuteSequence />
>
>     <InstallExecuteSequence>
>       <FindRelatedProducts Before="LaunchConditions" /><!-- search for
installed products using Upgrade table -->
>       <RemoveExistingProducts After="InstallInitialize" /> <!-- remove
products, found in FindRelatedProducts -->
>     </InstallExecuteSequence>
>
>     <InstallUISequence>
>       <FindRelatedProducts Before="LaunchConditions" />
>     </InstallUISequence>

To protect from downgrade I use <Condition> element in <Package>:
>     <Condition
>        Message='A later version of "[ProductName]" is already installed:
{[NEWAPPFOUND]}. Setup will now exit.'
>        >NOT NEWAPPFOUND</Condition>

So information, found in FindRelatedProducts, is used for 2 tasks:
- uninstall previously installed  products in action RemoveExistingProducts
- block downgrade installations calculating condition of Package. As I 
understand conditions validated in action LaunchConditions
So FindRelatedProducts must be executed before these 2 actions.

Also I have such properties (by default setup is per machine):
>       <Property Id="ALLUSERS" Value="1" />
>       <Property Id="ASSISTANCE_USERS">all</Property>
There is UI dialog, where user can change these properties to switch to 
per-user install.

The problem happens when first product is installed per-user.
If upgrade installation is launched, FindRelatedProducts is launched 
before UI dialog with selection per-user/per-machine. At this moment 
ALLUSERS has its default value "1". So FindRelatedProducts suppose that 
new installation will be per-machine (it is incorrect, because later 
user can switch to per-user installation in UI dialog). So 
FindRelatedProducts skips previous per-user installation with message in 
install log:
> MSI (c) (4C:38) [09:58:38:093]: FindRelatedProducts: current install is
per-machine.  Related install for product '{OLD-PRODUCT-UID}' is per-user.
Skipping...

Old product is not uninstalled and I have list of all versions of my 
product in add/remove products Windows applet.

As I understand the reason of problem is that FindRelatedProducts 
executed before UI dialog with selection between per-user/per-machine.

But I can not make FindRelatedProducts running after this dialog because 
FindRelatedProducts results is also used by LaunchConditions, which must 
run before UI dialogs.

How this problem must be solved? How to make FindRelatedProducts find 
previous per-user installation?

--
Thanks!

-----------------------------------------------------------------------------
-
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
SDL PLC confidential, all rights reserved.
If you are not the intended recipient of this mail SDL requests and requires 
that you delete it without acting upon or copying any of its contents, and we 
further request that you advise us.
SDL PLC is a public limited company registered in England and Wales.  
Registered number: 02675207.
Registered address: Globe House, Clivemont Road, Maidenhead, Berkshire SL6 7DY, 
UK.


------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to