Mitul
Mitul

Reputation: 75

Property value set in WiX based on registry key value

I want to set the INSTALL_DE property value to 1 if registry entry HKEY_CURRENT_USER\Control Panel\International\LocaleName has value de-DE.

I wrote the below code.

<Property Id="INSTALL_DE">
    <RegistrySearch
        Id="NetFramework20"
        Root="HKCU"
        Key="HKEY_CURRENT_USER\Control Panel\International"
        Name="LocaleName"
        Type="raw" />
</Property>

<SetProperty Id="INSTALL_DE" After="AppSearch" Value="1">
    <[CDATA[INSTALL_DE="de-DE"]]>
</SetProperty>

How do I correct it?

Upvotes: 2

Views: 2674

Answers (1)

Hille
Hille

Reputation: 4196

Following your sample code as close as possible, I see three problems:

  1. double use of identfier (in this case INSTALL_DE)
  2. wrong key name; do not prefix HKEY_CURRENT_USER to your search path, Root="HKCU" takes care of it
  3. Missing "!", in CDATA

Write e.g.

<Property Id="LOCAL_NAME">
    <RegistrySearch Id="NetFramework20"
            Root="HKCU"
            Key="Control Panel\International"
            Name="LocaleName"
            Type="raw" />
</Property>

<SetProperty Id="INSTALL_DE" After="AppSearch" Value="1">
    <![CDATA[LOCAL_NAME="de-DE"]]>
</SetProperty>

Upvotes: 5

Related Questions