[wix-devs] Bundles, persisted variables, and newer bundles
Jacob.Hoover at greenheck.com
Wed Oct 25 14:22:19 PDT 2017
What is the preferred way of accessing saved variable state from an existing installed bundle if the user has downloaded a newer bundle? For example, if I had a persistent burn variable, that was modifiable via the options page in WixStdBA, and it controlled "something" downstream. If the user is installing v1 of our bundle, they may customize the variables value. When they go to install v2, I would like for the customization from v1 to be read in by v2, so the user doesn't have to re-configure the application every time they upgrade.
If I was writing my own BA I know I could write code to persist this to the machine, but that would violate the rules that a BA shouldn't modify state (only installers should). I could pass the state into my applications main MSI, and have it persist this information in a known location, but then the application installer is taking on a role of managing the bundles state which doesn't seem right.
Should I even consider trying to poke into the existing rsm files in the cache for the detected package? In order to do so we would likely need to do a version check to ensure that the format of the state isn't incompatible from bundle to bundle over time with differing versions of WiX.
What I am pondering is given a bundle Id, we should expose an API that can read the state of that bundle. I know the BA / BAF would have to subscribe to OnDetectRelatedBundle / OnDetectComplete, and from there call the API for whatever criteria they have. I wouldn't want this API to modify my state. I am thinking if I added a BURN_VARIABLES* to BURN_RELATED_BUNDLE, and then on IBootstrapperEngine add methods for GetRelatedBundleVariableString / GetRelatedBundleNumeric. In the engine, where those methods are implemented we would lazy load variables, so only if you asked for a bundles variables, would we make the attempt to parse out the state data into a private collection of related bundle specific variables.
More information about the wix-devs