[wix-users] modify registry value string on install but do not remove registry value on uninstall
Wesley Manning
wmanning at dynagen.ca
Tue Sep 22 16:36:43 PDT 2020
Thanks. I found on every subsequent install if was doing what I want: always adding path3. Turns out I didn’t assign a KeyPath for that permanent component in the original installer. Is that because I didn’t set the <RegistryValue> as the keypath? It was the only item in the component. It’s been several years since I changed/tested that MSI so it may have always had that behavior. I just saw component marked permanent and assumed that it would never execute again.
I’m using several < SetProperty> and <CustomAction> elements to set the value of a property that represents “path3” and then the permanent component <RegistryValue> consumes that property so maybe that has something to do with it as well.
I still don’t like the idea of a permanent component so I came across this tip: https://stackoverflow.com/a/49243077/623561. Seems like you can install a feature but then prevent it from being uninstalled using a feature condition. Acts like a permanent feature but I like that I can change the condition in subsequent versions. Any downsides to this?
Wes
From: Edwin Castro <egcastr at gmail.com>
Sent: September 18, 2020 7:09 PM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Cc: Wesley Manning <wmanning at dynagen.ca>
Subject: Re: [wix-users] modify registry value string on install but do not remove registry value on uninstall
You'll need a custom action.
I would be suspicious of Permanent Components. Sometimes they're The Right Thing(tm) to do but they leave orphaned metadata behind so you want to minimize its use.
I would recommend against using Components to update any resource your installer does not own precisely because removing the Component will remove the resource (whatever that means for the resource) and is almost never what you want.
This case suggests a custom action that updates the registry value if the substring is not present for installs and a custom action that removes the substring from the registry value if present for uninstalls. You should be able to use those custom actions for rollback scenarios as well. Don't forget rollback.
--
Edwin G. Castro
On Fri, Sep 18, 2020 at 1:15 PM Wesley Manning via wix-users <wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org>> wrote:
Hi,
My installer is modifying an existing registry value that is not created by my installer. It is of type REG_SZ containing a semicolon delimited list of paths. ("path1;path2"). My MSI on install adds the substring "path3" so that it's now "path1;path2;path3". To do this I'm using a RegisteryValue element in a component marked Permanent.
Now I have a new requirement to check if the substring "path3" exists on every install and if it does not exist add it again. Permanent will prevent it from being checked again and if I use RegisteryValue without permanent I believe it removes the registry value on uninstall which I don't want.
Is there anyway of doing this other than a custom action?
Wes
____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
More information about the wix-users
mailing list