How do I find the GUID of the Wix Burn executable file to programmatically uninstall?

I created a wix bootstrapper project. When installed, it creates a registry key

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{SOME_GUID}

      

So I can remove it using ARP. But I want to remove it programmatically. To do this, I need the {SOME_GUID} value to find the key in the registry for the UninstallString value. However, it is not possible to get this information from my project because the Bundle element has no attributes to set this GUID.


I found out that this GUID is equal to the ProviderKey GUID, but only if the ProviderKey is automatically assigned. When I try to change the ProviderKey using the "ProviderKey" bundler attribute, the two GUIDs are no longer equal.

+3


source to share


2 answers


Every time you compile your bootstrapper project, a new ID is assigned to it - a GUID named BundleId, which you cannot change. In this respect, every kit you create is unique. The UpgradeCode attribute allows two bootloaders to be linked by creating their linked packages. This relationship allows one package to discover and update the installed packages of another.



+1


source


If you just want to get the "current" package ID, you can read it from BootstrapperApplicationData.xml at runtime. Not sure if there are better ways to do this.


However, if your problem is that multiple instances of the same version (different assembly) of the bootloader are installed side-by-side, then read on ...

I had a similar problem, since every time you compile the bootloader, your package has a new ID, which means if I try to install it again, it installs a different instance of the package (with a new ID) and then I 2 instances of mine packet in ARP. (Really dont know which use case for this ...)



I don't need two instances of a package, especially if they are identical versions. The only solution I found was to use one of the boottrapper events PlanRelatedBundle

to remove any related packages:

private void BootstrapperOnPlanRelatedBundle(object sender, PlanRelatedBundleEventArgs e)
{
    e.State = RequestState.Absent;
}

      

Note. I'm not sure if this is the best way to do it, but given the low documentation this is the best I've found.

0


source







All Articles