Bootstrapper exe file and multiple launch

Oct 24, 2016 at 3:17 PM
Edited Oct 25, 2016 at 11:23 AM
why, when i click a second (second is uninstall, third is install again, fourth uninstall etc.) time on the EXE file generated with burn.exe (i use silentbootstrapper) and I have already installed the application (with same GUID), all files removes (run as uninstall)? I work on Windows 10. This situation is same in examples for bootstrapper in WIX# downloaded collection. E.g. WixBootstrapper_NoUI or WixBootstrapper_UI. I also use MajorUpgrade in WixProject object.

Ideally, i want let to user know that the application (from bundle msi file) is already installed and he has to uninstall it first. Is it possible?

Thank you in advance.
Oct 26, 2016 at 3:03 AM
Edited Oct 26, 2016 at 3:48 AM
> Ideally, i want let to user know that the application (from bundle msi file) is already installed and he has to uninstall it first. Is it possible?
Then you should not be using silent bootstrapper as it automatically triggers install/uninstall based on the current state of the primary product. You can either use standard bootstrapper UI (provided by WiX), which has a clear indication of the current state of the product and doesn't proceed with the installation without the user confirmation.

Alternatively you can still quickly create your own bootstrapper UI (or even modify the silent bootstrapper UI) and ask the user all the question you need. See WixBootstrapper_NoUI sample for details. This sample has CustomSilentBA.cs file which implements custom bootstrapper application (BA). You can extend it with any sort of UI and also modify the "planing" algorithm:
DetectPackageComplete += (s, e) =>
    //Presence or absence of MyProductPackageId product will be a deciding factor 
    //for initializing BA for Install or Uninstall.
    if (e.PackageId == "MyProductPackageId")
            if (e.State == PackageState.Absent)
            else if (e.State == PackageState.Present)
And sample WixBootstrapper_UI shouws how to create a WPF UI for your bundle.
Oct 27, 2016 at 10:04 AM
Edited Oct 27, 2016 at 12:04 PM
Hi Oleg,
thanks a lot for your quick answer. Thats what i am looking for and it seems to work fine :-)

Unfortunately, one problem I found. After i click to Uninstall in Add/Remove programs and then call Engine.Plan(LaunchAction.Uninstall), it only removes Application from list of Add/Remove programs (and perhaps from registry? i dont know). So, is there a way that i call Uninstall complete? With all background action, as i click on uninstall link in installed folder.

Thank you.
Oct 27, 2016 at 10:22 AM
Hi again,
Maybe one more question :-). What localization and bootstrapper UI labels? Can I insert some translated xml to bootstrapper? For example like this:
bootstrapper.Language = "cs-CZ";
bootstrapper.Application.LocalizationFile = "PathToLocalizationFile";
Oct 28, 2016 at 12:43 AM
Hi Vojtech,

> only removes Application from list of Add/Remove programs...
I haven't observed this behavior before. I suggest you test it again but with the default WiX bootstrapper UI (WixBootstrapper sample). If it fixes that behavior then there is something incorrect with your DetectPackageComplete handler and you will need adjust it to match the algorithm implemented by WiX burn. The best way to do it is to put and then attach the debugger at runtime. If WiX bootstrapper UI shows the same behavior then the problem might be related to the nature of your setups. You will need to do some reading.

When I tested the complete WixBootstrapper sample uninstalling removed both products as expected.

> What localization and bootstrapper UI labels
If you build a custom UI then it is obvious :)
Though if you want to localize the standard bootstrapper UI then I expect setting bootstrapper.Application.LocalizationFile and bootstrapper.Language should do the trick.

Note that Wix# doesn't decorate Burn API in anyway but rather mirrors the XML interface directly. Meaning that if you find the XML solution for BA localization then you will be able to port it to C# very easy. My optimistic attempt to build German BA UI emitted healthy WXS:
<WixStandardBootstrapperApplication LogoFile="logo.png" LocalizationFile="WixUI_de-DE.wxl" LicenseUrl="licence.html" xmlns="" />
And seemingly correct build command:
"light.exe" -sw1076 -sw1079  -out ".....\setup.exe" "....\setup.wixobj"  -ext "WiXNetFxExtension" -ext "WiXBalExtension" -ext ".....\WixSharp.Samples\Wix_bin\bin"\WixUtilExtension.dll" -cultures:de-DE
However the final bootstrapper file (setup.exe) failed to start. Possibly because of the quality of me localization file. Thus you will need to do some investigation.