简体   繁体   中英

WiX Burn custom UI

I am trying to create a custom UI for WiX and Burn. I have followed some of the guides I've found, and so far I have a project that has the following, which inherits from BootstrapperApplication.

namespace MyBA
{
    public class TestBA : BootstrapperApplication
    {
        protected override void Run()
        {
            MessageBox.Show("My BA is running");
            this.Engine.Quit(0);
        }
    }
}

And in the AssemblyInfo.cs:

[assembly: BootstrapperApplication(typeof(TestBA))]

Then in my Bootstrapper project I have the following.

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

    <Bundle Name="MyApplication"
            Version="1.0.0"
            Manufacturer="Acme Ltd"
            UpgradeCode="F84A4058-FDF6-4218-BCB5-12C811DA3C99"
            Condition="NOT ((VersionNT = 600 AND ServicePackLevel >=2) OR (VersionNT >= 601))"
            IconSourceFile="$(var.MyApplicationInstallerRequiredFiles.ProjectDir)logo.ico"
            SplashScreenSourceFile="$(var.MyApplicationInstallerRequiredFiles.ProjectDir)Splashscreen.bmp"
            DisableRepair="no"
            DisableRemove="no"
            DisableModify="no">

        <WixVariable Id="WixMbaPrereqPackageId"
                     Value="Netfx4Full" />
        <WixVariable Id="WixMbaPrereqLicenseUrl"
                     Value="NetfxLicense.rtf" />

        <WixVariable Id="WixStdbaLicenseRtf"
                     Value="$(var.MyApplicationInstallerRequiredFiles.ProjectDir)Licence.en-gb.rtf" />
        <WixVariable Id="WixStdbaLogo"
                     Value="$(var.MyApplicationInstallerRequiredFiles.ProjectDir)logoInstallSmall.bmp" />

        <BootstrapperApplicationRef Id='ManagedBootstrapperApplicationHost'>
            <Payload Name='BootstrapperCore.config'
                     SourceFile='$(var.MyApplicationInstallerRequiredFiles.ProjectDir)Bootstrapper\MyBA.BootstrapperCore.config' />
            <Payload SourceFile='$(var.MyApplicationInstallerRequiredFiles.ProjectDir)Bootstrapper\MyBA.dll' />
        </BootstrapperApplicationRef>

        <Chain>
            <PackageGroupRef Id="MyApplicationPackage" />
        </Chain>
    </Bundle>
</Wix>

and I have added MyBA.BootstrapperCore.config

<?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="MyBA">
            <supportedFramework version="v4\Full" />
            <supportedFramework version="v4\Client" />
        </host>
    </wix.bootstrapper>
</configuration>

However, whenever I run the Setup.exe for the bootstrapper, I get the splashscreen appear briefly, but nothing else. If I look in the %TEMP% at the logs there is the following

[0A00:0424][2011-11-02T15:52:08]: Burn v3.6.2221.0, path: C:\MyApplication\dev\source\Bootstrapper1\bin\Debug\Setup.exe, cmdline: ''
[0A00:0424][2011-11-02T15:52:08]: Setting string variable 'WixBundleName' to value 'MyApplication'
[0A00:0424][2011-11-02T15:52:08]: Setting string variable 'WixBundleLog' to value 'C:\Users\AppData\Local\Temp\MyApplication_20111102155208.log'
[0A00:0424][2011-11-02T15:52:08]: Condition 'NOT ((VersionNT = 600 AND ServicePackLevel >=2) OR (VersionNT >= 601))' evaluates to true.
[0A00:0424][2011-11-02T15:52:08]: Setting string variable 'WixBundleOriginalSource' to value 'C:\MyApplication\dev\source\Bootstrapper1\bin\Debug\Setup.exe'
[0A00:0424][2011-11-02T15:52:08]: Loading managed bootstrapper application.
[0A00:0424][2011-11-02T15:52:08]: Error 0x80131040: Failed to create the managed bootstrapper application.
[0A00:0424][2011-11-02T15:52:08]: Error 0x80131040: Failed to create UX.
[0A00:0424][2011-11-02T15:52:08]: Error 0x80131040: Failed to load UX.
[0A00:0424][2011-11-02T15:52:08]: Error 0x80131040: Failed while running
[0A00:0424][2011-11-02T15:52:08]: Error 0x80131040: Failed to run per-user mode.

Why is this happening and why are the above errors occurring?

If you look at the source code for the WixBA, they declare a global Threading.Dispatcher, and then in the overridden Run() method, there is the following line:

Threading.Dispatcher.Run();

I had similar issues, and similarly adding the Threading.Dispatcher to my bootstrapper application fixed them.

Also, if your Bootstrapper Application depends on any other dlls, you need to include them as a <Payload/> under your <BootstrapperApplicationRef/> .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM