我正在开发一个Wix引导程序,我需要它有一个自定义UI,我已经找到并且一直遵循本教程https://medium.com/@rukshandangalla/how-i-created-custom-ui-using-wpf-mvvm-and-prism-for-wix-installer-5055c2b611e2,但是它是不完整的,并且没有说明如何将自定义UI链接到引导程序,我尝试将它添加为visual中的引用和包中的有效负载,但我不确定这是否是正确的方法。
当我试图在visual studio中构建它时,我会得到以下错误
要么没有定义'Microsoft.Tools.WindowsInstallerXml.AssemblyDefaultWixExtensionAttribute‘,要么无法加载扩展'..\Setup\bin\Debug\PETSetup.dll’中定义的类型。
这是我的包裹
<?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>这是自定义UI的主cs文件。
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的,而不是引导程序。
发布于 2018-05-28 05:58:13
问题0:检查如何在此处修复项目的配置文件( WiX Custom Bootstrapper Application and .NET 4.5 )
问题1:引导程序是由wix引擎在每一步启动的,您的cosutom引导程序通过调用其中一种方法来控制进程:例如,您调用了Engine.Detect()和Engine.Quit(),但是要获得回手,您必须实现事件处理程序:就像在DetectEnds上那样,然后执行您的工作,然后用类似的计划返回wix --检查这个示例https://github.com/rstropek/Samples/tree/master/WiXSamples/CustomBurnUI
https://stackoverflow.com/questions/50525784
复制相似问题