Les
Les

Reputation: 10605

Wix - How to distinguish registry key with no default value from no registry key

Given the following...

<Property Id="TESTSEARCH">
   <RegistrySearch Id="LookingForKeyExists"
                  Root="HKLM"
                  Key="Software\Classes\.ext"
                  Type="raw" />
</Property>

... I can get one of three conditions.

  1. The key is not present
  2. The key is present but not set
  3. The key is present and has a value

I would like to be able to tell the difference between the following conditions.

<Condition Message="The extension .ext is missing">
    ???
</Condition>
<Condition Message="The extension .ext has no default value">
    ???
</Condition>

But all I've been able to find/figure out is the OR of the two.

<Condition Message="The extension .ext is either missing or does not have a default value">
    TESTSEARCH
</Condition>

Can the two separate conditions be distinguished without writing an extension? If so, how?

Upvotes: 0

Views: 365

Answers (1)

Yan Sklyarenko
Yan Sklyarenko

Reputation: 32240

I don't think it is possible and it looks like Windows Installer limitation, rather than WiX toolset. This original article on MSDN states that explicitly:

Note that it is not possible to use the RegLocator table to check only for the presence of the key. However, you can search for the default value of a key and retrieve its value if it is not empty.

Upvotes: 1

Related Questions