我使用ManagedBootstrapperApplicationHost
使用WPF
前端(使用WiX 3.9)创建了自定义WiX刻录安装程序。
我的MSI安装正常。我使用mBootstrapperApplication.Engine.Detect();
来确定MSI包是否存在。如果是,我遵循类似于安装的流程,以便卸载:
mBootstrapperApplication.Engine.Plan(LaunchAction.Uninstall);
一旦进入PlanComplete
事件和Status == 0
,我就会致电mBootstrapperApplication.Engine.Apply(System.IntPtr.Zero);
并最终返回ApplyComplete
Status == 0
事件。
不幸的是,在那一点似乎没有发生任何事情。
我迷上ExecuteMsiMessage
并且没有消息传来。当ExecuteBegin
被触发时,PackageCount
为0,我相信它应为1。
如有必要,我可以发布代码。我的wxs文件如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Bundle Name="CustomInstallBootstrapper" Version="1.0.0.0" Manufacturer="Square Enix Ltd." UpgradeCode="33CA185D-083B-4D45-A0AE-693C2E09C5F0">
<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
<Payload SourceFile="D:\Project\CustomInstallBootstrapper\BootstrapperCore.config"/>
<Payload SourceFile="D:\Project\CustomInstallBootstrapper\CustomInstallBootstrapper.dll"/>
</BootstrapperApplicationRef>
<WixVariable Id="WixMbaPrereqPackageId" Value="ignore" />
<WixVariable Id="WixMbaPrereqLicenseUrl" Value="ignore" />
<Chain>
<PackageGroupRef Id="NetFx451Redist"/>
<MsiPackage Id="LauncherMSI" SourceFile="D:\Project\Launcher.msi" Cache="yes" Visible="no">
</MsiPackage>
</Chain>
</Bundle>
</Wix>
如果我自己运行MSI,我可以毫无问题地安装和卸载它。