Reputation: 5322
I have a setup that has an optional parameter which should be written to the registry is supplied. I know that i can write to the registry using this:
<DirectoryRef Id="TARGETDIR">
<Component Id="RegistryEntries" Guid="*">
<RegistryKey Root="HKCU"
Key="Software\Microsoft\Test"
Action="create">
<RegistryValue Type="string" Value="[THEPARAMETER]"/>
</RegistryKey>
</Component>
</DirectoryRef>
But this will override the existing registry entry with an emtpy string, if the parameter is not specified!
I would like to know how to set the registry key ONLY if the parameter is specified. I have looked into custom actions and WriteRegistryValues, but I haven't found anything helpful.
Upvotes: 2
Views: 371
Reputation: 1790
Add the condition like this
<Condition>(THEPARAMETER AND (NOT Installed))</Condition>
<RegistryValue Type="string" Value="[THEPARAMETER]"/>
Upvotes: 3