Wix Bootstrapper 自定义 UI 问题

Wix Bootstrapper Custom UI Issues

我正在开发 Wix 引导程序,我需要它有一个自定义 UI 我发现并一直在关注本教程 https://medium.com/@rukshandangalla/how-i-created-custom-ui-using-wpf-mvvm-and-prism-for-wix-installer-5055c2b611e2 但它不完整,没有说明如何 link 自定义 UI 到引导程序 我尝试将其添加为 visual studio 中的参考和捆绑包中的有效载荷,但我不确定这是否是正确的方法。

当我尝试在 visual studio 中构建它时,出现以下错误

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

这是我的包裹

<?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>

这是自定义的主要cs文件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);
        }
    }
}

我应该怎么做才能让它发挥作用?或者有人知道更好的分步教程吗?因为我能找到的唯一其他的是 Msi 的,而不是引导程序。

问题 0: 在此处检查如何修复项目的配置文件

问题 1: 引导程序由 wix 引擎启动 在每一步,你的 cosutom 引导程序通过调用其中一个方法来交回过程:你调用了例如 Engine.Detect() 和 Engine.Quit() 但是要收回你的手,你必须实现事件处理程序:像 DetectEnds 然后做你的工作,然后用 like Plan 交回 wix 检查这个例子 https://github.com/rstropek/Samples/tree/master/WiXSamples/CustomBurnUI