An installation package is organized into Components and Features. The installation of a component can be conditioned directly with a property, however this is not always true for features. By conditioning a component, the component will not be installed by Windows Installer if the condition is not met.I don't see how a conditional variable used with the Organisation of the features solves this problem...because the service details seem to be tied to the feature that installs the EXE?
Please note that the settings of the service are written inside the MSI file, not in the registry. When the MSI package is installed the service will be created and configured based on the tables inside the MSI. Therefore, what you need can be done only through a custom action conditioned to run only during repair.I still want repair to create the service in the registry if it has got "lost", overriding the functionality as above.
OK I guess I can see how to do that...although I must say it seems a bit odd that I have to do this...surely it is a common scenario patching a service exe and not wanting to disturb the service settings?cosmin wrote:If you want to update the service and still keep some of its settings, the only solution is to use a custom action. This custom action can have two functions:
- the first function memorizes the service settings before the patch is applied
- the second function replaces the settings made by the patch with the one memorized before the patch was applied
Yes that's true, except that I create the service using installer variables for those parameters so that they are not "hard coded" in the msi file. At least that offers the scope to pass them through again when the patch is applied as above. But Repairing is another matter...I can't really see a way around the fact that after the repair, (unless that was also done from the command line too...) the user will have to reset the service parameters.Please note that the settings of the service are written inside the MSI file, not in the registry. When the MSI package is installed the service will be created and configured based on the tables inside the MSI. Therefore, what you need can be done only through a custom action conditioned to run only during repair.
I'm afraid that this is not supported by Windows Installer.surely it is a common scenario patching a service exe and not wanting to disturb the service settings?
Yes, the installation package can use installer properties for the username and password of the service. These properties can be written into the registry and retrieved by searches in the upgraded package. However, this cannot be done for the start type of the service.I assume that if I set up the service parameters (start type, user account and password) as installer variables passed through on the command line when the original install was done, that if I do the same when applying the patch that should also work?
Please note that this is the recommended approach. If the user configures the service incorrectly he should be able to repair it in order to restore the default settings.But Repairing is another matter...I can't really see a way around the fact that after the repair, (unless that was also done from the command line too...) the user will have to reset the service parameters.
This can be done by using the "Never Overwrite" attribute for the components of the registry entries. If this attribute is set before the component is installed, the component will not be overwritten if it already exists (by a patch for example). Note that this will not work for an upgrade because the old component is uninstalled and then the new one is installed.I too am searching for a way to protect the values of certain registry entries during an upgrade, while still deleting them in a full uninstall.
We will consider including this feature in a future version of Advanced Installer. Thank you for your suggestion.What I think we'd all like is a checkbox on each registry item that says "if this entry exists, keep the old value". Couldn't AI just generate custom actions to take care of this?