[wix-users] Getting JSON Settings File to Survive Major Upgrade

Bevan Weiss bevan.weiss at gmail.com
Tue Dec 21 14:00:09 PST 2021


Surviving Major Upgrade but still disappearing at the end of use seems like a tough challenge.

I've got a bad solution.
On uninstall register a RunOnce action to delete the files/folder.
On install remove any such RunOnce entry.

I'm probably wrong, but I've always consider major upgrade just an uninstall->reinstall with some installer settings migrated across. So this would survive such a process.


There's likely a better solution though.


Regards,
Bevan

22 Dec 2021 08:46:23 Bryan Dam via wix-users <wix-users at lists.wixtoolset.org>:

> 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
> 
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/



More information about the wix-users mailing list