WIX Bootstrapper - Selected MSI packages uninstallation - wix

I have created a Wix custom bootstrapper application and bundle file using Wix 3.8. Bundle file contains five MSI packages. Created a setup and installed it. All MSI packages are installed and uninstalled correctly.
Then, I have include "InstallCondition" attribute in each MSI package elements in bundle file. Installed the setup based on the selection (installed three MSI packages). Installation working fine.
Now I want to uninstall any of selected MSI packages from installed packages (three packages installed) using custom BA.
Is it possible do the above using Wix CBA? Please share any idea regarding this.
Thanks

You need to call Plan with the Modify action (or Uninstall if you want to uninstall the whole bundle). Then in the OnPlanPackageBegin callback, set the desired state of the package (Absent to uninstall). I think if the InstallCondition of a package evaluates to false during a Modify or Uninstall action, the engine would plan to uninstall it by default.

Related

Wix bootstrapper uninstalling MSI package in silent mode

I have an msi bundled with prerequisites using Wix bootstrapper (burn.exe).
We migrated this project from Installshield to WiX.
The installation works fine.
However, during repair or uninstall the bootstrapper runs the msi-file in silent mode.
Since the last dialog (e.g. 'SetupCompleteSuccess') within the msi file contains some controls to trigger some more actions.
Is there a possibility to configure the bootstrapper so that the msi file is executed in 'UI'-mode?
In WiX v3, it is not possible. Burn explicitly shows internal UI only during initial install. WiX v4 changes how that works: https://github.com/wixtoolset/issues/issues/5616

How to uninstall previous Burn package when installing MSI

Let's say that I have distributed a WiX Burn package with a certain upgrade code (I do not know any product codes). Let's say that I decide that moving forward, I want to move to an MSI package. The question is: how can I remove the previous Burn package given the upgrade code when I install the MSI package? I have given both the same Upgrade Code, but the MSI appears not to uninstall Burn by default.
You'd likely need to write a custom action in your MSI that walked through all registry keys under:
HKLM\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall
and searched for a registry value "BundleUpgradeCode" with the value of your static UpgradeCode guid. When you find it, read in the value of the entry "UninstallString" or "QuietUninstallString". That's the command you'll need to execute in order to uninstall the previous bundle before installing your new MSI.
Caveat: there's no rollback support with this approach if you uninstall the old bundle and the new MSI installer fails. You'll end up with a machine that has neither of your products installed.

WiX: how to add setup.exe to the existing MSI?

I have a wix project which builds msi for my application.
This installer has upgrade code 1.
Sometimes It requires administrative permissions to be run.
That is why I'd like to add setup.exe which will run the msi.
The only one way I see to create Bundle.
I.e.
1. wixproj builds MSI (upgrade code 1)
2. wixproj which builds bundle package including msi (p.1.)(upgrade code 2)
These projects have different upgrade codes. How it will work if run on machine where the old product already installed with upgrade code 1 and was installed without bundle?
Bundle upgrade codes are distinct from MSI package upgrade codes. Burn lets the package upgrade itself.

prevent bundle getting uninstalled until all chained msis are uninstalled [duplicate]

My Requirements:
I have few MSI files which need to be installed. User can select which one he wants to install/uninstall. For this purpose I have used WiX bootstrapper where I have used WPF UI to list down all the MSI and few buttons to Intstall/Upgrade/Uninstall
Till now I am able to install selected MSI using InstallCondition but could not manage the uninstall. If I uninstall any of the MSI, the Bundle is also getting uninstalled. Hence it is not showing in the Add/Remove Program.
So I would like to know if there is any way to allow uninstall of individual MSI but not the Bundle itself?
I'm guessing your bundle is getting uninstalled because you are using Engine.Plan(LaunchAction.Uninstall). If you use a different action like Install or Modify, it shouldn't be removed.
To control the install state of the individual MSI packages, I think you can set that in a callback to PlanPackageBegin.

How do I programmatically uninstall a cached Wix Burn program

I have created a Wix Burn app that I am installing two MSI's with. Works great.
The MSI files install properly
The Wix Burn app registers with ARP.
The MSI files do not register with ARP
I can do Major Upgrades
I can install and uninstall manually with a local copy of the Wix Burn app
I can programmatically execute the Wix Burn app to uninstall (using /x)
The Problem:
I know two way to uninstall using a Wix Burn app:
Click on the Uninstall button in ARP (requires user involvement)
Launch a copy of the Wix Burn app that installed the product
I see in the Wix Burn log that Windows caches my Wix Burn app install in much the same way that MSIEXEC will cache MSI files. Is there a way to programmatically ask Windows or MSI to use the cached version of the Wix Burn app to do the uninstall?
A Possibility:
Presumably I could use MsiGetProductInfo() to get a path to the cached Wix Burn app. To do that, however, I need my app's Product Code. However, Product Codes are not attributes of elements in Wix so I am not seeing how to get a Product Code for a Burn package.
You might be able to solve this by iterating through the Uninstall registry entries. The process is:
Open HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall.
Iterate through the sub-keys searching for an entry where the Publisher and DisplayName matches your product.
If you find an entry, read the value of QuietUninstallString and run that as a command. For a WIX burn installer this is typically in the form C:\ProgramData\Package Cache\{GUID}\SetupProgram.exe /uninstall /quiet.
If you are using a 64 bit operating system you will also need to search HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall.