1

I am working on a Wix bootstrapper and I need it to have a custom UI I found and have been following this tutorial https://medium.com/@rukshandangalla/how-i-created-custom-ui-using-wpf-mvvm-and-prism-for-wix-installer-5055c2b611e2 But it's incomplete and doesn't show how to link the custom UI to the bootstrapper I have tried adding it as a reference in visual studio and as a payload in the bundle but I'm not sure if this is the correct way to do it.

When I try to build it in visual studio I get the following error

Either 'Microsoft.Tools.WindowsInstallerXml.AssemblyDefaultWixExtensionAttribute' was not defined or the type defined in extension '..\Setup\bin\Debug\PETSetup.dll' could not be loaded.

This is my bundle

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <Bundle Name="Abundle name" Version="2.0.1" Manufacturer="manu" Condition="VersionNT64" UpgradeCode="254822db-8638-44bc-8815-95d0506b5145" IconSourceFile="X:\SS\Wix Installer\icon.ico">
    <BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">  
      <Payload SourceFile="X:\SS\Wix Installer\Setup\bin\Debug\BootstrapperCore.config"/>
      <Payload SourceFile="X:\SS\Wix Installer\Setup\bin\Debug\PETSetup.dll"/>
      <Payload SourceFile="C:\Program Files (x86)\WiX Toolset v3.11\SDK\Microsoft.Deployment.WindowsInstaller.dll"/>
    </BootstrapperApplicationRef>

         <WixVariable Id="WixMbaPrereqPackageId" Value="Netfx4Full" />
    <WixVariable Id="WixMbaPrereqLicenseUrl" Value="X:\SS\Wix Installer\eula.rtf" />

    <bal:Condition Message="You need to install .Net Framework 4.0 or higher in order to run this install">
      <![CDATA[Netfx4FullVersion]]>
    </bal:Condition>

    <Chain>
      <ExePackage Vital="yes" Permanent="yes" Cache="yes" SourceFile="X:\SS\Source\Bin\PrerequistesInstaller.exe"/>
    </Chain>

    <util:RegistrySearch Id="Net40" Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Version" Variable="Netfx4FullVersion" Result="exists"/>
  </Bundle>
</Wix>

And this is the main cs file of the custom UI

using Microsoft.Tools.WindowsInstallerXml.Bootstrapper;
using PETSetup.Models;
using PETSetup.ViewModels;
using PETSetup.Views;
using System.IO;
using System.Windows.Threading;

namespace PETSetup
{
    public class PETSetup : BootstrapperApplication
    {
        Microsoft.Tools.WindowsInstallerXml.AssemblyDefaultWixExtensionAttribute t = new Microsoft.Tools.WindowsInstallerXml.AssemblyDefaultWixExtensionAttribute(typeof(PETSetup));
        public static Dispatcher Dispatcher { get; set; }
        protected override void Run()
        {
            Dispatcher = Dispatcher.CurrentDispatcher;
            var model = new BootstrapperApplicationModel(this);
            var viewModel = new InstallViewModel(model, Engine);
            var view = new InstallView(viewModel);

            model.SetWindowHandle(view);

            Engine.Detect();
            view.Show();
            Dispatcher.Run();
            Engine.Quit(model.FinalResult);
        }
    }
}

What am I supposed to do to get this to work? or does anyone know of a better step by step tutorial? because the only other ones I can find are for Msi's, not bootstrappers.

CodeF0x
  • 2,624
  • 6
  • 17
  • 28
Gavin
  • 13
  • 4

1 Answers1

0

issue 0: check how to fix the config file of your project here WiX Custom Bootstrapper Application and .NET 4.5

issue 1: the bootstrapper is launched by the wix engine at each step your cosutom bootstrapper hands back the process by calling one of the methode: you called for example Engine.Detect() and Engine.Quit() but to get the hand back you have to implement event handlers: like on DetectEnds then do your work, and then hand back to wix with like Plan check this example https://github.com/rstropek/Samples/tree/master/WiXSamples/CustomBurnUI

Hassan
  • 313
  • 1
  • 2
  • 12
  • As another example you can look at the WixBA.csproj that is on the wix3 github for the source code of the installer used to install Wix itself. Just checkout the git repo (https://github.com/wixtoolset/wix3) and open burn.sln in visual studio. – Brian Sutherland May 28 '18 at 20:57