Update bootstrapper package if same version found

I have a WiX bootstrapper package:

<Bundle Name="blah" Version="1.0.0" Manufacturer="blah" UpgradeCode="some-guid-string">

      

When I create a new assembly and try to install it over the previous installation, the bootstrapper has to update itself (from the same version), however it will leave the old version of itself in programs and functions. What can I do to remove the previous version completely if you install it in the same version, and how can I remove the old assembly from programs and functions? I have looked online but there are no clear answers on this topic.

Edit : This question hints to use a custom BA to override the default behavior by changing the request state in OnPlanRelatedBundle. I'm not sure if people understand this, or how can I connect to the OnPlanRelatedBundle ... can anyone clarify? Is a custom BA = custom build action?

+4


source to share


3 answers


Sorry to bring the old post back to life, but since there is still no support for WiX 3.10 I thought I posted my work.

The caveat with this method is that double-clicking on the package you just installed will not bring up the usual "change, remove" dialog. What I did to handle this is put in <bal:Condition>

, which instructs the user to use "Add Remove Programs" if they want to invoke the remove or change functions.

The reason I need this, instead of just incrementing to perform the upgrade, is because we have online and offline packages. I want them not to be installed at the same time.

Another thing is that this approach requires your package version ID to match the MSI version ID. Enough caveat, here's the approach:

Create a product search, but importantly, use UpgradeCode

for your MSI package, not packages! ProductSearch will never find your connector GUID because Bundle is an .exe, not an MSI.

<util:ProductSearch
        Variable="BundleAlreadyInstalled"
        UpgradeCode="MSI-GUID-NOT-BUNDLE-GUID"
        Id="BundleAlreadyInstalledSearch"
        Result="version"
                />

      

Next, inside your elements <bundle>

add the following:



<Variable Name="CurrentVersionNumber" Type="string" Value="$(var.Version)" />
<bal:Condition Message="Tell your user to use Add Remove Programs here.">
    NOT WixBundleAction = 5 OR NOT BundleAlreadyInstalled = CurrentVersionNumber
</bal:Condition>

      

The core of the hack here is that we use the MSI version (which, as I said, must match the Bundle version for this reason) as a key indicator of whether this package is present on the target system.

If you haven't enabled it NOT WixBundleAction = 5

, you won't be able to uninstall the app, which is important.

For the second part, we want to specifically determine if this version is installed. Upgrades and downgrades will fail this test, which is what we want because the normal logic will start and do the upgrade / downgrade.

Without this logic, my users could install the online and offline versions of the package at the same time. The main reason for this is that Bundle@Id

WiX is generated. Another more subtle issue is that simply restoring the package without changing the version will also allow you to install it side-by-side! You will get duplicates in "Add Remove Programs" for all of these.

These problems are completely prevented by these few lines of code. As I mentioned, the trade-off is that setting and then executing an exact dial will not result in a delete dialog again, but it is much easier to live with than duplicate ARP entries. Moreover, you can simply provide instructions in the error message.

+1


source


Try to list the related element in your Bootstrapper.



<RelatedBundle Id="THE-BUNDLE-UPGRADE-GUID" Action="Upgrade"/>

      

0


source


I found a way to work around my problem without changing the WiX source code.

I have disabled my bootstrapper package from programs and functions:

<Bundle DisableRemove="yes" DisableModify="yes" ... />

      

I really didn't need to show up. I just needed the package it builds and installs to actually show up. Then I just showed that the MSI package it installed was instead:

<MsiPackage Visible="yes" ... />

      

-1


source







All Articles