|
159 | 159 | <Chain DisableSystemRestore="yes" ParallelCache="yes">
|
160 | 160 |
|
161 | 161 | <!--
|
162 |
| - The finalizer is not an installation package. It's detected based on the bundle's installation state (WixBundleInstalled). |
163 |
| - |
164 |
| - User action | Install | Repair | Modify | Uninstall | Uninstall (Upgrade) |
165 |
| - WixBundleInstalled | FALSE | TRUE | TRUE | TRUE | TRUE |
166 |
| - WixBundleAction | 6 | 8 | 7 | 4 | 4 |
167 |
| - Finalizer (Plan) | None | Execute | Execute | Execute | Execute |
168 |
| - |
169 |
| - Setting an InstallCondition will cause Burn to remove the package if it evaluates to FALSE and |
170 |
| - the bundle is being installed, repaired, or modified. This breaks upgrades. We cannot use |
171 |
| - WixBundleAction in the DetectCondition because it's not finalized until the planning phase completes (after |
172 |
| - the detect phase). See https://github.com/orgs/wixtoolset/discussions/9017 for more detail. |
173 |
| - |
174 |
| - The finalizer also takes the bundle action as a parameter to ensure it no-ops, but logs the action. --> |
| 162 | + The finalizer is not an installation package (ExePackage@Bundle="no"). For an install, the finalizer has no |
| 163 | + effect, but must be detected as absent. When an install is cancelled, the engine re-eavaluates package state. If |
| 164 | + a package is detected as present the resume mode is set to BURN_RESUME_MODE_ARP and causes the bundle registration |
| 165 | + to remain. When the bundle is removed, it finalizer must be detected as installed to ensure it executes. |
| 166 | +
|
| 167 | + Setting the detect condition to WixBundleInstalled causes the finalzier state to track the bundle state. This causes |
| 168 | + the finalizer to run during install, repair and uninstall actions. We can't use WixBundleAction in |
| 169 | + ExePackage@DetectCondition because it's value is only final after planning completes after the detect phase. |
| 170 | + See https://github.com/orgs/wixtoolset/discussions/9017 for more detail. |
| 171 | +
|
| 172 | + Instead, we pass WixBundleAction to the finalizer as parameter when the package is applied. This allows the finalizer |
| 173 | + to no-op during an install and repair, but clean up when the bundle is being remvoed. --> |
175 | 174 | <ExePackage SourceFile="$(FinalizerExeSourceFile)"
|
176 | 175 | Bundle="no"
|
177 | 176 | Cache="keep"
|
178 |
| - DetectCondition="1=1" |
| 177 | + DetectCondition="WixBundleInstalled" |
179 | 178 | Id="Finalizer"
|
180 | 179 | InstallArguments=""[WixBundleLog_Finalizer]" $(Version) $(TargetArchitecture) [WixBundleAction]"
|
181 | 180 | UninstallArguments=""[WixBundleLog_Finalizer]" $(Version) $(TargetArchitecture) [WixBundleAction]"
|
|
0 commit comments