cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
DataAnalyzer
Level 8

Registry Branch Defined in Code

Jump to solution
Is there a way to set registry branches programmatically? I've created separate components for essentially the same set of registry entries. The only difference is that the branch uses a different version number. Can I just use one component to handle all versions and set that version in my script? Thanks.
Labels (1)
0 Kudos
(1) Solution
MichaelU
Level 12 Flexeran
Level 12 Flexeran
If you're using a Basic MSI project, registry keys, value names, and value data can embed property references to determine the resulting, ah, value. So perhaps it as simple as creating a single set of keys that includes [MYVERSION], and setting the property MYVERSION to the correct version.

If you're using an InstallScript project, I forget if there's a good way to do it in the registry view, but this can definitely be done with script code.

View solution in original post

0 Kudos
(5) Replies
MichaelU
Level 12 Flexeran
Level 12 Flexeran
If you're using a Basic MSI project, registry keys, value names, and value data can embed property references to determine the resulting, ah, value. So perhaps it as simple as creating a single set of keys that includes [MYVERSION], and setting the property MYVERSION to the correct version.

If you're using an InstallScript project, I forget if there's a good way to do it in the registry view, but this can definitely be done with script code.
0 Kudos
DataAnalyzer
Level 8
Thank you for your response. It's good to know that it's possible programmatically, so I have one option that way. The challenge I've had in the past with setting things in code is that it doesn't always run when I release an update, so I'm forced to require the user to uninstall and reinstall which is not so friendly. Maybe I'm missing how to have code run whether it's a new install or update.

Regardless, it'd be great if there could be a way to just set it through the Registry view. As you suspected, I simply need a new version branch for each version and I'm currently "forced" to create a new Registry component for each version which becomes a bigger and bigger problem to keep in snyc over time. Any suggestions for that would be greatly appreciated. Thanks.

MichaelU wrote:
If you're using a Basic MSI project, registry keys, value names, and value data can embed property references to determine the resulting, ah, value. So perhaps it as simple as creating a single set of keys that includes [MYVERSION], and setting the property MYVERSION to the correct version.

If you're using an InstallScript project, I forget if there's a good way to do it in the registry view, but this can definitely be done with script code.
0 Kudos
MichaelU
Level 12 Flexeran
Level 12 Flexeran
Oh, I think I took the wrong picture of the use case. I was thinking something like InstallShield has, where each version of InstallShield installs a single registry branch with a version number in it. Or maybe a slight variant of that where it's a slightly different version number depending on something else, but only one at a time.

Is your case instead that you need to install several similar branches from one installation, and the number of such branches continually increases over time? I don't have a great answer for that, and totally understand that script seems like an attractive approach. Just bear in mind that component rules are pretty picky about this sort of modification, so, if you stick with the view and need to support minor upgrades, be careful to create new components as appropriate.
0 Kudos
DataAnalyzer
Level 8
Sorry for not being clear. Within one ISM file, I have multiple releases. Each release is for a different version and has its own flags.

Currently, I've created a different component for each version's registry. Within it, it uses variable values to put into the registry.

The only difference between the registry components is the version number for its branch. I'd like to avoid having to create a different registry component for each version and just have one. If I could set the branch as a variable, that would solve my problem.
0 Kudos
DataAnalyzer
Level 8

What I've since discovered with this solution is that the registry branch (key) defined with a variable doesn't get removed when the program is uninstalled. It is set to uninstall the entire key.

Any reason why it would be different as a variable versus hardcoded value? 

0 Kudos