首页 > 解决方案 > 使用 WiX 引导程序安装 winforms 应用程序的先决条件

问题描述

我创建了一个 C# WinForms 应用程序,它依赖于 .NET Framework 版本 4.6.1 和 GhostScript 9.2.1(32 位 Windows)。我为 WinForms 应用程序制作了一个简单的 Windows 安装程序(.msi 文件),但 GhostScript 库拒绝安装。因此,我决定使用 WiX 引导程序制作捆绑安装程序。

在引导程序项目中,我打包了之前的 GhostScript exe 安装程序和简单的 msi 安装程序。我想我还在引导程序的前几行中处理了 .NET 框架。

现在,我在使用 Bootstrap 安装程序时仍然面临一个问题。问题是安装跳过了 msi 安装程序。如何让 Bootstrap 安装成功完成?

这是引导程序项目的 XML:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Bundle Name="Bootstrapper1" Version="1.0.0.0" Manufacturer="POD" UpgradeCode="390cbc0b-980b-4f35-a9de-a11228f75b69">
        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
    <PayloadGroup Id="NetFx461RedistPayload">
        <Payload Name="redist\NDP461-KB3102436-x86-x64-AllOS-ENU.exe"
                 SourceFile="C:\Users\Admin\Downloads\NDP461-KB3102436-x86-x64-AllOS-ENU.exe"/>
    </PayloadGroup>

        <Chain>
            <!-- TODO: Define the list of chained packages. -->
            <!-- <MsiPackage SourceFile="path\to\your.msi" /> -->
      <PackageGroupRef Id="NetFx461Web"/>
      <ExePackage Id="Ghostscript_32_bit_Version_9.2.1"
                  Cache="yes"
                  Compressed="yes"
                  PerMachine="yes"
                  Permanent="yes"
                  Vital="yes"
                  SourceFile="C:\Users\Admin\Downloads\gs921w32new.exe"
                  InstallCommand="/passive /norestart" />
      <MsiPackage Id="POD_Measuring_Tool"
                  Cache="yes"
                  Compressed="yes"
                  Permanent="yes"

                  Vital="yes"
                  SourceFile="C:\Users\Admin\Documents\POD\Workspace Folder\c# projects\6lumber\toolPOD\Debug\toolPOD.msi" />
        </Chain>
    </Bundle>
</Wix>

我引用了 WixBalExtension 和 WixNetFxExtension,msi 文件和 ghostscript exe 来自我的计算机。

标签: winformswixghostscript

解决方案


问题是安装跳过了 msi 安装程序。

这可能表明该产品已安装。MsiPackage将通过检查注册表中的产品代码自动检测是否已安装 msi。

MsiPackage/@Permanent属性还意味着在卸载 Bootstrapper 时不会删除您的产品 - 因此请检查您是否手动删除了 msi,并且日志记录有助于-l logfile.txt切换。


推荐阅读