[wix-users] Condition question - "Installed"

Walter Dexter wfdexter at gmail.com
Wed Oct 11 10:00:12 PDT 2017


Hi-

I have an installer that installs either one set of files or the other set
of files depending on a registry value.

This seems like it's working, but I'm not sure if I should be including
"Installed OR" in my condition. In my limited testing it doesn't seem like
it matters, but maybe I'm missing something. WiX source snips are below.

Notes:

   - This MSI is for internal use only, installing only on Server 2003
   (32-bit) or Server 2012 (64-bit.)
   - HKLM\SOFTWARE\a\b\c\d is a REG_SZ that will always contain 6.2 digits.
   - Server 2003 platforms will never have a value that satisfies the
   Feature2 condition.
   - The components within the ComponentGroups all have versioned files as
   their KeyPath (A DLL with version resource.)
   - The non-KeyPath files within the components land in the same location
   from both ComponentGroups.
      - "CGOne" installs copies of "one.dll" and "a.ini" to three different
      directories.
      - "CGTwo" installs  "two.dll" and "a.ini" to the same three
      directories.
   - It is likely that an older version of the same MSI (same UpgradeCode,
   different ProductCode) will already have been installed on the target
   system, along with files "old.dll" and "a.ini" already present in the same
   three directories.
   - Please excuse any typos; I re-keyed, simplified and anonymized the
   following XML. My employer prefers that we remain semi-anonymous.

<Property Id="VALUE" Secure="yes">
  <RegistrySearch Id="RS_VALUE" Root="HKLM" Key="SOFTWARE\a\b\c" Name="d"
Type="raw" Win64="yes" />
</Property>

<Feature Id="Feature1" Title="Files for Less" Level="0">
    <ComponentGroupRef Id="CGOne" />
    <Condition Level="1"><![CDATA[Installed OR VALUE < "120000.00"
]]></Condition>
</Feature>

<Feature Id="Feature2" Title="Files for More" Level="0">
    <ComponentGroupRef Id="CGTwo" />
    <Condition Level="1"><![CDATA[Installed OR VALUE >= "120000.00"
]]></Condition>
</Feature>

<ComponentGroup Id="CGOne">
    <Component Id="CG1a" Guid="...." Directory="DIR_COPYA" Transitive="yes"
>
        <File Id="CG1aDLL" Source="one.dll" KeyPath="yes" />
        <File Id="CG1aINI" Source="a.ini" KeyPath="no" />
    </Component>
    <Component Id="CG1b" Guid="...." Directory="DIR_COPYB" Transitive="yes"
>
        <File Id="CG1bDLL" Source="one.dll" KeyPath="yes" />
        <File Id="CG1bINI" Source="a.ini" KeyPath="no" />
    </Component>
    <Component Id="CG1c" Guid="...." Directory="DIR_COPYC" Transitive="yes"
>
        <File Id="CG1cDLL" Source="one.dll" KeyPath="yes" />
        <File Id="CG1cINI" Source="a.ini" KeyPath="no" />
    </Component>
</ComponentGroup>

<ComponentGroup Id="CGTwo">
    <Component Id="CG2a" Guid="...." Directory="DIR_COPYA" Transitive="yes"
>
        <File Id="CG2aDLL" Source="two.dll" KeyPath="yes" />
        <File Id="CG2aINI" Source="a.ini" KeyPath="no" />
    </Component>
    <Component Id="CG2b" Guid="...." Directory="DIR_COPYB" Transitive="yes"
>
        <File Id="CG2bDLL" Source="two.dll" KeyPath="yes" />
        <File Id="CG2bINI" Source="a.ini" KeyPath="no" />
    </Component>
    <Component Id="CG2c" Guid="...." Directory="DIR_COPYC" Transitive="yes"
>
        <File Id="CG2cDLL" Source="two.dll" KeyPath="yes" />
        <File Id="CG2cINI" Source="a.ini" KeyPath="no" />
    </Component>
</ComponentGroup>

So what do you guys think - "Installed" needed, or better without it? Why?

Any other feedback? I was uncomfortable with the "Win64=yes" but based on
logs it's reading the registry key successfully on the 32-bit platform.

I'm also not quite sure if the "Transitive" is gaining me anything.

Thanks!

Walt


More information about the wix-users mailing list