[wix-users] Getting JSON Settings File to Survive Major Upgrade
Bryan Dam
bryand at recastsoftware.com
Tue Dec 21 13:46:11 PST 2021
I've got a .Net Core web application which uses JSON files in the application's root directory for application settings. Apparently that's how .Net rolls now. The installer takes settings from the user and stores them in appsettings.Production.json. I need this file to get written on install, survive major upgrades, and be removed on final uninstall.
I've tried many methods and have gotten close but not quite all the way. I've got a custom action writing the setting to the file on initial install. It's getting the file to survive the major upgrade's uninstall while also getting removed during a final uninstall that I can't quite figure out.
I've tried using a Heat transform to add combinations of NeverOverwrite, Permanent, and UninstallWhenSuperseded but can't get it to both survive the major upgrade uninstall while also being removed by a final uninstall.
I've tried using the RemoveFile element but the on="Uninstall" doesn't differentiate between a major upgrade uninstall and a final uninstall.
I tried adding a condition to the RemoveFile component to try and skip it during major upgrade but that didn't pan out either.
The closest I can get is to run another custom action to delete the file on uninstall. Perfectly happy with that solution but when uninstalled it leaves the empty installation folder behind. I suspect that's because the custom action runs after CostFinalize?
Is there a way to delete a file in a custom action without preventing a final folder cleanup? Is there some other method I'm missing here?
Thanks,
Bryan
More information about the wix-users
mailing list