Custom WiX Burn bootstrapper user interface?

非 Y 不嫁゛ 提交于 2019-11-28 02:54:04
Bill Campbell

The key thing to know is that there is a BootstrapperCore.dll in the WiX binaries that defines a BootstrapperApplication class that handles the integration with the Burn engine. I needed to create my own derived class and override the 'Run' method to launch my custom UI.

It was also helpful to use the WixBA project that defines the UI for the WiX bootstrapper as a reference for using the BootstrapperApplication class (src\Setup\WixBA\WixBA.csproj).

The markup I used to reference my custom bootstrapper DLL file is:

<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost" >
  <Payload SourceFile="$(var.InstallSourceResources)Bootstrapper\FusionInstallUX.dll"/>
  <Payload Id="FusionInstallUX.config"
           SourceFile="$(var.InstallSourceResources)Bootstrapper\FusionInstallUX.BootstrapperCore.config"
           Name="BootstrapperCore.config" Compressed="yes"/>
</BootstrapperApplicationRef>

The configuration file consists of:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <sectionGroup
            name="wix.bootstrapper"
            type="Microsoft.Tools.WindowsInstallerXml.Bootstrapper.BootstrapperSectionGroup, BootstrapperCore">

            <section
                name="host"
                type="Microsoft.Tools.WindowsInstallerXml.Bootstrapper.HostSection, BootstrapperCore" />
        </sectionGroup>
    </configSections>

    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0" />
    </startup>

    <wix.bootstrapper>
        <host assemblyName="FusionInstallUX">
            <supportedFramework version="v4\Full" />
            <supportedFramework version="v4\Client" />
        </host>
    </wix.bootstrapper>
</configuration>

I also followed other examples and appended

[assembly: BootstrapperApplication(typeof([name of class deriving from BootstrapperApplication]))]

to the AssemblyInfo.cs file.

And lastly, Stack Overflow question Specify the INSTALLLOCATION of packages in WiX inside the Burn managed bootstrapper describes how to set and use Burn variables to help drive the installation.

Armed with this information I am now prepared to wreak havoc on the world with my very own custom Bootstrapper application!

John M. Wright

To supplement @Bill Campbell's answer, I've written a series of blog posts on writing a custom WiX Bootstrapper in .NET which goes into more depth about the pieces involved, at least for a managed code solution.

Dave Andersen

In addition to the other resources listed here, a good bare-bones example of a custom bootstrapper application for Burn is Custom WiX Managed Bootstrapper Application.

I found that this is a good place to start with before digging deeper into other more thorough examples like the WixBA project in the WiX sources.

Not precisely answer to this question, but if you want to customize appearance of ManagedBootstrapperApplicationHost, then this is what you need to do.

To keep short, you need to declare your variables like this (I put it before BootstrapperApplicationRef)

<WixVariable Id="PreqbaThemeXml" Value="tt.thm" />
<WixVariable Id="PreqbaThemeWxl" Value="tt.wxl" />

assuming tt.thm is your theme file, and tt.wxl is your translation file. Note those files, as well as all files they reference must be included to BootstrapperApplicationRef as Payoload, like

<Payload SourceFile="tt.wxl"/>
<Payload SourceFile="tt.wxl"/>
<Payload SourceFile="cat.png"/>

As an example of layout you can use mbapreq.thm, found under WiX sources.

user2932857

One detail I was missing when setting this up was that I had to include a reference to WixBalExtension.dll. That's because the ManagedBootstrapperApplicationHost is defined in that DLL and used in the bundle like this:

<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
      <Payload Name="BootstrapperCore.config"
               SourceFile="MyBA.BootstrapperCore.config" />
      <Payload SourceFile="MyBA.dll"/>
</BootstrapperApplicationRef>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!