UI is not displayed when I combine a ManagedUI MSI with a Bundle bootstrapper

Jun 5, 2016 at 2:03 PM
Is it possible to use the ManagedUI (created by the "WixSharp Managed Setup - Custom UI" visual studio template for example) as the chained MSI in a Bundle based bootstrapper?

When I run the MyProduct.exe created by the following code, no UI appears.
Jun 5, 2016 at 2:03 PM
using System;
using WixSharp;
using WixSharp.Bootstrapper;
using WixSharpSetup.Dialogs;
using io = System.IO;

namespace WixSharpSetup {
    class Program {
        static void Main() {
            var mainAppMsi = BuildMainAppInstallerMsi();

            // Bootstrapper won't display managed UI...
            BuildBootstrapperExe(mainAppMsi);
        }

        static void BuildBootstrapperExe(string mainAppMsi) {

            var bootstrapper =
              new Bundle("MyPrereqs"
                    , new PackageGroupRef("NetFx40Web")
                    , new MsiPackage(mainAppMsi) { DisplayInternalUI = true }
                    );

            bootstrapper.Version = new Version("1.0.0.0");
            bootstrapper.UpgradeCode = new Guid("6f330b47-2577-43ad-9095-1861bb25844b");
            bootstrapper.Application = new SilentBootstrapperApplication();

            bootstrapper.PreserveTempFiles = true;

            var bootstrapperExe = io.Path.ChangeExtension(mainAppMsi, ".exe");
            bootstrapper.Build(bootstrapperExe);
        }

        static string BuildMainAppInstallerMsi() {

            var project = new ManagedProject("MyProduct",
                             new Dir(@"%ProgramFiles%\My Company\My Product",
                                 new File("Program.cs")));

            project.GUID = new Guid("6fe30b47-2577-43ad-9095-1861ba25889b");

            //custom set of standard UI dialogs
            project.ManagedUI = new ManagedUI();

            project.ManagedUI.InstallDialogs.Add<WelcomeDialog>()
                                            .Add<LicenceDialog>()
                                            .Add<SetupTypeDialog>()
                                            .Add<FeaturesDialog>()
                                            .Add<InstallDirDialog>()
                                            .Add<ProgressDialog>()
                                            .Add<ExitDialog>();

            project.ManagedUI.ModifyDialogs.Add<MaintenanceTypeDialog>()
                                           .Add<FeaturesDialog>()
                                           .Add<ProgressDialog>()
                                           .Add<ExitDialog>();

            //project.SourceBaseDir = "<input dir path>";
            //project.OutDir = "<output dir path>";

            ValidateAssemblyCompatibility();

            return project.BuildMsi();
        }

        static void ValidateAssemblyCompatibility() {
            var assembly = System.Reflection.Assembly.GetExecutingAssembly();

            if (!assembly.ImageRuntimeVersion.StartsWith("v2.")) {
                Console.WriteLine("Warning: assembly '{0}' is compiled for {1} runtime, which may not be compatible with the CLR version hosted by MSI. " +
                                  "The incompatibility is particularly possible for the EmbeddedUI scenarios. " +
                                   "The safest way to solve the problem is to compile the assembly for v3.5 Target Framework.",
                                   assembly.GetName().Name, assembly.ImageRuntimeVersion);
            }
        }
    }
}

Coordinator
Jun 6, 2016 at 1:55 AM
Unfortunately Burn has a defect which leads to not showing embedded UI even when DisplayInternalUI is set to true.
The issue is logged (https://github.com/wixtoolset/issues/issues/4918/) and WiX team scheduled fixing the issue 4918/4921 for WiX v4.0.

This is unfortunate as there seems to be no any work around and building a custom bootstrapper UI (BA) seems to be the only available option for now.