PDA

View Full Version : Registry Branch Defined in Code



DataAnalyzer
07-25-2015, 09:10 AM
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.

MichaelU
07-27-2015, 08:25 AM
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.

DataAnalyzer
07-27-2015, 08:34 AM
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.


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.

MichaelU
07-27-2015, 08:44 AM
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.

DataAnalyzer
07-27-2015, 08:55 AM
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.