I want to determine if a Registry key exists in Wix. I cannot make any assumptions about value names in that key, but at least one exists. Default value is not set. Is it possible to check if the key exists (and optionally, if it has any values) without using custom actions?
Asked
Active
Viewed 5,807 times
3
-
1Answer is you can't, see this for more information: [http://stackoverflow.com/questions/1327203/in-wix-how-do-i-test-for-the-existence-of-a-registry-key-not-value-for-oracle][1] [1]: http://stackoverflow.com/questions/1327203/in-wix-how-do-i-test-for-the-existence-of-a-registry-key-not-value-for-oracle – Casper Leon Nielsen Oct 26 '12 at 12:08
-
http://stackoverflow.com/questions/1327203/in-wix-how-do-i-test-for-the-existence-of-a-registry-key-not-value-for-oracle – Casper Leon Nielsen Oct 26 '12 at 12:08
1 Answers
6
Have a look at the RegistrySearch
Sample of use:
<Property Id="MYRegSearch" Value="AVaLue" Secure="yes">
<RegistrySearch Id="RegSearch" Root="HKLM" Key="Software\!(wix.Manufacturer)\!(wix.ShortProduct)" Name="Values" Type="raw"/>
</Property>

Bhargav Rao
- 50,140
- 28
- 121
- 140

CheGueVerra
- 7,849
- 4
- 37
- 49
-
I know about RegistrySearch, but I don't know how to use it to check if a key exists – Juozas Kontvainis Sep 17 '09 at 15:43
-
I would put a flag value to the property like -1, then you can check in a condition that the property is different than -1 – CheGueVerra Sep 17 '09 at 17:11
-
3As default key value does not have a value set, Property value doesn't get changed. It seems I will need custom action to test it. – Juozas Kontvainis Sep 18 '09 at 07:51
-
If the key exists the value will change, otherwise it will stay the same. – CheGueVerra Sep 18 '09 at 17:27
-
@CheGueVerra not true at all... what if value is empty? If you are looking for default value for example... and it is not set, then your property will not be changed... – Dusan Plavak Sep 28 '13 at 13:20