[wix-users] How do you conditionally set a property or RegistryValue in WiX?

Thomas Sondergaard thomas at sondergaard.cc
Thu Mar 25 02:49:39 PDT 2021


I have also asked the following question on stackoverflow (link
in case you want to answer it there and gain points. However, after having
reviewed the answers to WiX questions on stackoverflow and on this mailing
list, I decided the odds of getting a good answer were better here. So here
is my question:

I have a Wix Toolset project with a component such as the one below, where
MYLANGUAGE is a public property that can be set when installing the product:

      <Component Id='language_reg' Guid='*' Permanent='yes'>
        <RegistryValue Type='string' Root='HKLM'
Key='Software\MyCompany\MyProduct' Name='language'
        Value='[MYLANGUAGE]' KeyPath='yes' />

Now I am upgrading this software package from 32-bit 64-bit. The key above
from the existing 32-bit versions of my software is stored under
HKLM\Software\WOW6432Node\MyCompany\MyProduct because of WOW64.

After an upgrade to a new 64-bit version of the package the upgrade I would
like to have the value set in the HKLM\Software\MyCompany\MyProduct key
too. The value shall be set like this:

   - If the public property MYLANGUAGE is set when installing then the
   value of that property shall be stored in HKLM\Software\MyCompany\MyProduct
   - If the public property MYLANGUAGE is not set *and*
   HKLM\Software\MyCompany\MyProduct key doesn't exist and
   HKLM\Software\WOW6432Node\MyCompany\MyProduct language value is set then I
   want the value copied from HKLM\Software\WOW6432Node\MyCompany\MyProduct
   language to HKLM\Software\MyCompany\MyProduct language

How can I do this with WIX Toolset?

Best regards,


More information about the wix-users mailing list