Nick B
Nick B

Reputation: 161

How to find GUID of Wix Burn executable for programmatically uninstall?

I've created wix bootstrapper project. While installing it creates registry key

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

So I can uninstall it using ARP.But I'd like to uninstall it programmatically.To do this I need the value of {SOME_GUID} to search the key in registry for UninstallString value. However it's impossible to get this information from my project, because Bundle element does not have attributes to set this GUID.


I found out that this GUID is equal to Bundle's ProviderKey GUID, but only if ProviderKey is assigned automatically. When I try to change ProviderKey using bundle "ProviderKey" attribute this two GUIDs are not equal anymore.

Upvotes: 5

Views: 1743

Answers (2)

user145400
user145400

Reputation: 1084

If you just want to obtain the "current" bundle's ID then you can read it from BootstrapperApplicationData.xml at runtime. Not sure if there are better ways to do that.


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

I had a similar problem: since every time you compile the bootstrapper your bundle has a new ID, that meant if I try to install it again it was installing another instance of the bundle (with the new ID) and then I had 2 instances of my bundle in ARP. (Really don't know what the use case for this is..)

I don't want 2 instances of the bundle, especially if they are identical versions. The only solution I found was to use one of the bootstrapper's events PlanRelatedBundle to remove any "related" bundles:

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

Note: I'm not sure if this is the best way to go about this, but considering the poor documentation it's the best I've found.

Upvotes: 0

Isaiah4110
Isaiah4110

Reputation: 10120

Each time that you compile your bootstrapper project, it is assigned a new identity—a GUID called BundleId that you cannot change. In this respect, every bundle that you create is unique. The UpgradeCode attribute allows us to link two bootstrappers, making them related bundles. This relationship allows one bundle to detect and upgrade the installed packages of the other.

Upvotes: 1

Related Questions