如何在WIX中包含msi/Setup.exe的先决条件

Nar*_*yan 4 installation wix prerequisites wix3.6

我正在尝试将我的包组合在一个设置EXE文件中并将其上传到Internet.

我创建了一个Microsoft引导程序,其中包含带有项目MSI输出的Setup.exe ,以及必备的.NET Framework 2.0,Windows Installer 3.1,Visual C++ 2005可再发行组件和Microsoft ReportViewer.我使用Visual Studio 2008创建了一个安装项目.

现在我正在尝试使用WiX 3.6 创建单个压缩设置.我已经在Visual Studio 2008中安装了它.

我使用以下命令附加了setup.exe和MSI文件.

<ExePackage SourceFile ="setup.exe" Compressed ="yes"/>
<MsiPackage SourceFile ="myproject.msi" Compressed ="yes" />
Run Code Online (Sandbox Code Playgroud)

但它无法找到MSI文件.我怎样才能包含上述先决条件?

或者我可以在安装时从Internet下载上述先决条件吗?我该怎么做?

Nar*_*yan 6

setup.exe从Visual Studio中删除了默认设置,并使用Visual Studio中的MSI文件和依赖项创建了一个WiX 3.6 Bootstrapper:

<?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="My Application"
            Version="1.0"
            IconSourceFile ="E:\logo.ico"
            Manufacturer="My company"
            UpgradeCode="4dcab09d-baba-4837-a913-1206e4c2e743">

        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
            <bal:WixStandardBootstrapperApplication
                LicenseFile="E:\License.rtf"
                SuppressOptionsUI ="yes"
                LogoFile ="logo.ico" />
        </BootstrapperApplicationRef>

        <Chain>
            <ExePackage
                SourceFile ="ReportViewer\ReportViewer.exe"
                Compressed ="yes"
                Vital ="no"
                Permanent ="yes"/>
            <ExePackage
                SourceFile ="vcredist_x86\vcredist_x86.exe"
                Compressed ="yes"
                Vital ="no"
                Permanent ="yes"/>
            <MsiPackage
                SourceFile ="MySetup.msi"
                Compressed ="yes"
                DisplayName ="My Application"
                ForcePerMachine ="yes"/>
        </Chain>
    </Bundle>
</Wix>
Run Code Online (Sandbox Code Playgroud)

它压缩为具有先决条件的单个EXE文件.


Tom*_*get 5

SourceFile将接受 .msi 文件的相对路径。或者,如果您使用 WiX 安装项目构建 .msi 文件,则可以在WiX Bootstrapper项目中添加对安装项目的引用。它定义了您可以像这样使用的变量:

<MsiPackage SourceFile ="$(var.myproject.TargetPath)" Compressed ="yes" />
Run Code Online (Sandbox Code Playgroud)

如果您放弃Visual Studio Bootstrapper并将所有先决条件放入 WiX Bootstrapper 中,您的用户可能会获得更好的体验。这对您来说会需要更多的工作,因为没有预定义的ExePackageGroupExePackage适合您项目的所有先决条件。

检查定义中应包含哪些内容的信息的最佳位置ExePackage是相关特定先决条件的文档。但是,与 Visual Studio Bootstrapper 包(例如,在 参考资料中C:\Program Files\Microsoft Visual Studio 9\SDK\v2.0\Bootstrapper\Packages)以及 WiX 源代码中可能预定义的类似先决条件进行比较也很有启发。特别是,在 WiX 源代码中,您会发现ExePackage在安装时如果需要,可以从 Internet 下载 .NET 4。