cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
MattHolmesTX
Level 3

Registry key name based on a property value?

Is it possible to have a registry key's name be based on a property? I know it's possible to have registry values us properties, but the obvious idea of doing [PropertyName] as the registry key name does not work.

I tried getting cute and writing a custom action to change the entry in the Registry table, but Session.Database returns a read-only database that you can't modify. As it stands now, I am stumped. How do you create a registry key who's name is based on something programmatic? Particularly user input.

This is all Basic MSI, we do not (and will not) use InstallScript. We want our installations to be pure Windows Installer.
Labels (1)
0 Kudos
(5) Replies
RobertDickau
Flexera Alumni

Yes, you should be able to use [PropertyName] as a key name (see the MSI help for Registry Table). For example, the following seemed to work:
0 Kudos
MattHolmesTX
Level 3

Hmmmmmm, let me try again. Maybe it did work and I am out of my mind.
0 Kudos
MattHolmesTX
Level 3

Ahh, I know what the issue is. The property replacement seems to happen at build time, not runtime...so if I change that property at runtime, the registry entry doesn't reflect this. I change the property at runtime.
0 Kudos
MattHolmesTX
Level 3

Ah ha, got it. Custom properties seem to be reset to their default values when the UI sequence ends and the Execution sequence begins. Having the custom action that sets the properties after CostFinalize of both sequences fixed the problem.
0 Kudos
RobertDickau
Flexera Alumni

Or using a public property---one with an all-caps name---should do it: CUSTOMPROP instead of CustomProp. You might look into SecureCustomProperties to ensure the value makes it from UI to Execute, but first things first.
0 Kudos