I have finally figure out how to fix this, the condition should be as
follows:

  <InstallExecuteSequence>
    <Custom Action="SetFEATURES_REG" After="CostFinalize">
      <![CDATA[&Features = 3 OR (&Features = -1 AND !Features = 3)]]>
    </Custom>
  </InstallExecuteSequence>

This seems to work for me YMMV.

Neil

-----Original Message-----
From: Neil Sleightholm [mailto:[EMAIL PROTECTED] 
Sent: 14 November 2008 09:40
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Always Reinstall a Component

Just in case anyone else if following this, it doesn't work! Well
actually most of does expect this:
    <Custom Action="SetFEATURES_REG" After="CostFinalize">
      <![CDATA[&Features = 3]]>
    </Custom>
 
The feature value doesn't get set unless the feature is changed so if
you reinstall and leave everything the same the wrong value is written
to the registry.
 
Neil
 
Neil Sleightholm
X2 Systems Limited
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 
 

________________________________

From: Neil Sleightholm [mailto:[EMAIL PROTECTED]
Sent: Thu 13/11/2008 22:18
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Always Reinstall a Component



Thanks Bob I think I have it. Hope fully I will get time to blog this
but here is a quick summary:

This is the feature you want to use to set a registry value (it needs at
least 1 component in it):
  <Feature Id="Features" Level="10" Title="Features" Description="Some
feature." Display="expand">
    <ComponentRef Id="compDummy" />
  </Feature>

This feature is used to actually install/reinstall the registry value:
  <Feature Id="regFeature" Level="1" Display="hidden">
    <ComponentRef Id="compFeatures" />
  </Feature>

This custom action is used to calculate the registry value, if the
feature "Features" is set then FEATURES_REG = 1 (we could use
SetProperty but there is a bug in it at the moment which would stop this
working):
  <Property Id="FEATURES_REG" Value="0" />
  <CustomAction Id="SetFEATURES_REG" Property="FEATURES_REG" Value="1"
/>
  <InstallExecuteSequence>
    <Custom Action="SetFEATURES_REG" After="CostFinalize">
      <![CDATA[&Features = 3]]>
    </Custom>
  </InstallExecuteSequence>

This custom action forces reinstallation of regFeature (I think the
condition is correct but I had a few false starts that meant the msi
wouldn't uninstall):
  <CustomAction Id="SetREINSTALL" Property="REINSTALL"
Value="regFeature" />
  <InstallExecuteSequence>
    <!-- Only run on reinstall -->
    <Custom Action="SetREINSTALL" Before="CostInitialize">
      Installed AND NOT (REMOVE ~= "ALL")
    </Custom>
  </InstallExecuteSequence>


Finally this is the component that sets the registry value:
  <Component Id="compFeatures"
Guid="4922CDB0-9684-45FE-B53B-3C16B05E4A99">
    <RegistryValue Id="regFeatures" Root="HKLM"
Key="SOFTWARE\[Manufacturer]"
        Name="Feature" Value="[FEATURES_REG]" Type="integer"
Action="write" KeyPath="yes" />
  </Component>



Neil

-----Original Message-----
From: Bob Arnson [mailto:[EMAIL PROTECTED]
Sent: 13 November 2008 18:07
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Always Reinstall a Component

Neil Sleightholm wrote:
> When I approached this it seemed a really simple requirement - all I
want was "set registry key to 1 if feature selected, set to 0 if not".
It works ok on initial install but seem impossible on "Change".
>  

As long as you're just ADDLOCALing and REMOVEing features, no component
will get reinstalled. So try this:

1. Move the component tied to the registry resource into its own
feature.
2. In InstallExecuteSequence, before CostInitialize, set REINSTALL to
that feature when doing a Change.

You'll have to play around with #2 a bit; I'm just extrapolating from
the doc on the timing needed and you'll have to get the condition right.

The idea is to let the user pick features to add and remove but to
reinstall the registry feature only when not initially installing or
repairing, uninstalling, or major-upgrading the whole product. Then
REINSTALLMODE kicks in and you can get the overwrite behavior you're
looking for.

--
sig://boB
http://joyofsetup.com/



------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge Build the coolest Linux based applications with Moblin SDK &
win great prizes Grand prize is a trip for two to an Open Source event
anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge Build the coolest Linux based applications with Moblin SDK &
win great prizes Grand prize is a trip for two to an Open Source event
anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to