WIX Burn Bootstrapper,安装 .net 框架作为负载

WIX Burn Bootstrapper, installing .net framework as payload

我想做的事情:

制作一个 wix burn bundle bootstrapper,如果需要,首先安装 .net 4.8 框架,然后安装我们的自定义 MSI 自定义 MSI 一切正常并且可以正常工作。

我想要一个文件,我知道它有 100,000 K 大,我们可以接受(一旦您打包到 .net 4.8 安装程序中)

然后让引导程序自动解包并 运行 如果需要安装 .net 框架,但我尝试过的所有方法都不起作用。它要么想要下载它(我们不想指望互联网访问),要么打开文件对话框显示想要指向 .net 框架安装。

以下所有代码:

<?xml version="1.0" encoding="UTF-8" ?>

<Wix
    xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Bundle
        Name="OurSoftwareName"
        Version="1.0.0.0"
        Manufacturer="Our Company name"
        UpgradeCode="deleted guid here so no one accidentally uses it">
        <BootstrapperApplicationRef
            Id="WixStandardBootstrapperApplication.RtfLicense" />
<!--
        <PayloadGroup Id="NetFx48RedistPayload">
            <Payload Name="redist\ndp48-x86-x64-allos-enu.exe"
                SourceFile=".\Files\ndp48-x86-x64-allos-enu.exe"/>
        </PayloadGroup>
-->
        <Chain>
            <PackageGroupRef
                Id="NetFx48RedistPayload" />
            <MsiPackage
                After="NetFx48Redist"
                SourceFile="$(var.ReferenceToOurMsi.Setup.TargetPath)" />
        </Chain>
    </Bundle>
</Wix>

并且我复制并更改了 .net 4.8 版本的 wix 代码并进行了一些自定义:

https://github.com/wixtoolset/wix3/blob/develop/src/ext/NetFxExtension/wixlib/NetFx48.wxs

<?xml version="1.0" encoding="utf-8" ?>

<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->

<!--
copied from:
https://github.com/wixtoolset/wix3/blob/develop/src/ext/NetFxExtension/wixlib/NetFx48.wxs
-->

<Wix
    xmlns="http://schemas.microsoft.com/wix/2006/wi"
    xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

    <!--
        .NET Framework installation state properties

        Official documentation can be found at the following location:

           .NET Framework 4.5.x/4.6.x/4.7.x/4.8.x - http://msdn.microsoft.com/en-us/library/w0x726c2(v=vs.110).aspx
    -->

    <?define NetFx48MinRelease = 528040 ?>
    <?define NetFx48WebLink = https://go.microsoft.com/fwlink/?LinkId=2085155 ?>
    <?define NetFx48RedistLink = https://go.microsoft.com/fwlink/?LinkId=2088631 ?>
    <?define NetFx48EulaLink = https://referencesource.microsoft.com/license.html ?>

    <Fragment>
        <PropertyRef
            Id="WIXNETFX4RELEASEINSTALLED" />
        <Property
            Id="WIX_IS_NETFRAMEWORK_48_OR_LATER_INSTALLED"
            Secure="yes" />
        <SetProperty
            Id="WIX_IS_NETFRAMEWORK_48_OR_LATER_INSTALLED"
            Value="1"
            After="AppSearch">
            WIXNETFX4RELEASEINSTALLED >= "#$(var.NetFx48MinRelease)"
        </SetProperty>
    </Fragment>

    <Fragment>
        <util:RegistrySearchRef
            Id="NETFRAMEWORK45" />

        <WixVariable
            Id="WixMbaPrereqPackageId"
            Value="NetFx48Web" />
        <WixVariable
            Id="WixMbaPrereqLicenseUrl"
            Value="$(var.NetFx48EulaLink)"
            Overridable="yes" />
        <WixVariable
            Id="NetFx48WebDetectCondition"
            Value="NETFRAMEWORK45 &gt;= $(var.NetFx48MinRelease)"
            Overridable="yes" />
        <WixVariable
            Id="NetFx48WebInstallCondition"
            Value=""
            Overridable="yes" />
        <WixVariable
            Id="NetFx48WebPackageDirectory"
            Value="redist\"
            Overridable="yes" />

        <PackageGroup
            Id="NetFx48Web">
            <ExePackage
                InstallCommand="/q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx48WebLog].html&quot;"
                RepairCommand="/q /norestart /repair /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx48WebLog].html&quot;"
                UninstallCommand="/uninstall /q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx48WebLog].html&quot;"
                PerMachine="yes"
                DetectCondition="!(wix.NetFx48WebDetectCondition)"
                InstallCondition="!(wix.NetFx48WebInstallCondition)"
                Id="NetFx48Web"
                Vital="yes"
                Permanent="yes"
                Protocol="netfx4"
                DownloadUrl="$(var.NetFx48WebLink)"
                LogPathVariable="NetFx48WebLog"
                Compressed="no"
                Name="!(wix.NetFx48WebPackageDirectory)ndp48-web.exe">
                <RemotePayload
                    CertificatePublicKey="F49F9B33E25E33CCA0BFB15A62B7C29FFAB3880B"
                    CertificateThumbprint="ABDCA79AF9DD48A0EA702AD45260B3C03093FB4B"
                    Description="Microsoft .NET Framework 4.8 Setup"
                    Hash="4181398AA1FD5190155AC3A388434E5F7EA0B667"
                    ProductName="Microsoft .NET Framework 4.8"
                    Size="1439328"
                    Version="4.8.4115.0" />
            </ExePackage>
        </PackageGroup>
    </Fragment>

    <Fragment>
        <util:RegistrySearchRef
            Id="NETFRAMEWORK45" />

        <WixVariable
            Id="WixMbaPrereqPackageId"
            Value="NetFx48Redist" />
        <WixVariable
            Id="WixMbaPrereqLicenseUrl"
            Value="$(var.NetFx48EulaLink)"
            Overridable="yes" />
        <WixVariable
            Id="NetFx48RedistDetectCondition"
            Value="NETFRAMEWORK45 &gt;= $(var.NetFx48MinRelease)"
            Overridable="yes" />
        <WixVariable
            Id="NetFx48RedistInstallCondition"
            Value=""
            Overridable="yes" />
        <WixVariable
            Id="NetFx48RedistPackageDirectory"
            Value="redist\"
            Overridable="yes" />

        <PackageGroup
            Id="NetFx48Redist">
            <ExePackage
                InstallCommand="/q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx48RedistLog].html&quot;"
                RepairCommand="/q /norestart /repair /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx48RedistLog].html&quot;"
                UninstallCommand="/uninstall /q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx48RedistLog].html&quot;"
                PerMachine="yes"
                DetectCondition="!(wix.NetFx48RedistDetectCondition)"
                InstallCondition="!(wix.NetFx48RedistInstallCondition)"
                Id="NetFx48Redist"
                Vital="yes"
                Permanent="yes"
                Protocol="netfx4"
                DownloadUrl="$(var.NetFx48RedistLink)"
                LogPathVariable="NetFx48RedistLog"
                Compressed="no"
                Name="!(wix.NetFx48RedistPackageDirectory)ndp48-x86-x64-allos-enu.exe">
                <RemotePayload
                    CertificatePublicKey="F49F9B33E25E33CCA0BFB15A62B7C29FFAB3880B"
                    CertificateThumbprint="ABDCA79AF9DD48A0EA702AD45260B3C03093FB4B"
                    Description="Microsoft .NET Framework 4.8 Setup"
                    Hash="E322E2E0FB4C86172C38A97DC6C71982134F0570"
                    ProductName="Microsoft .NET Framework 4.8"
                    Size="117380440"
                    Version="4.8.4115.0" />
            </ExePackage>
        </PackageGroup>
    </Fragment>

    <Fragment>
        <util:RegistrySearchRef
            Id="NETFRAMEWORK45" />

        <WixVariable
            Id="WixMbaPrereqPackageId"
            Value="NetFx48Redist" />
        <WixVariable
            Id="WixMbaPrereqLicenseUrl"
            Value="$(var.NetFx48EulaLink)"
            Overridable="yes" />
        <WixVariable
            Id="NetFx48RedistDetectCondition"
            Value="NETFRAMEWORK45 &gt;= $(var.NetFx48MinRelease)"
            Overridable="yes" />
        <WixVariable
            Id="NetFx48RedistInstallCondition"
            Value=""
            Overridable="yes" />
        <WixVariable
            Id="NetFx48RedistPackageDirectory"
            Value="redist\"
            Overridable="yes" />

        <PackageGroup
            Id="NetFx48RedistPayload">
            <ExePackage
                InstallCommand="/q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx48RedistLog].html&quot;"
                RepairCommand="/q /norestart /repair /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx48RedistLog].html&quot;"
                UninstallCommand="/uninstall /q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx48RedistLog].html&quot;"
                PerMachine="yes"
                DetectCondition="!(wix.NetFx48RedistDetectCondition)"
                InstallCondition="!(wix.NetFx48RedistInstallCondition)"
                Id="NetFx48Redist"
                Vital="yes"
                Permanent="yes"
                Protocol="netfx4"
                LogPathVariable="NetFx48RedistLog"
                Compressed="no"
                SourceFile=".\Files\ndp48-x86-x64-allos-enu.exe">

                <Payload Name="ndp48-x86-x64-allos-enu.exe"
                    SourceFile=".\Files\ndp48-x86-x64-allos-enu.exe"/>
            </ExePackage>
        </PackageGroup>
    </Fragment>
</Wix>

我从来没有在任何 google 搜索中发现这个,但显然将压缩设置为“是”是关键,这样做时不需要有效负载。在这一点上完全按照我的意愿工作。单个(大)文件并自动提取和运行。

<?xml version="1.0" encoding="utf-8" ?>

<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->

<!--
copied from:
https://github.com/wixtoolset/wix3/blob/develop/src/ext/NetFxExtension/wixlib/NetFx48.wxs
-->

<Wix
    xmlns="http://schemas.microsoft.com/wix/2006/wi"
    xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

    <!--
        .NET Framework installation state properties

        Official documentation can be found at the following location:

           .NET Framework 4.5.x/4.6.x/4.7.x/4.8.x - http://msdn.microsoft.com/en-us/library/w0x726c2(v=vs.110).aspx
    -->

    <?define NetFx48MinRelease = 528040 ?>
    <?define NetFx48WebLink = https://go.microsoft.com/fwlink/?LinkId=2085155 ?>
    <?define NetFx48RedistLink = https://go.microsoft.com/fwlink/?LinkId=2088631 ?>
    <?define NetFx48EulaLink = https://referencesource.microsoft.com/license.html ?>

    <Fragment>
        <PropertyRef
            Id="WIXNETFX4RELEASEINSTALLED" />
        <Property
            Id="WIX_IS_NETFRAMEWORK_48_OR_LATER_INSTALLED"
            Secure="yes" />
        <SetProperty
            Id="WIX_IS_NETFRAMEWORK_48_OR_LATER_INSTALLED"
            Value="1"
            After="AppSearch">
            WIXNETFX4RELEASEINSTALLED >= "#$(var.NetFx48MinRelease)"
        </SetProperty>
    </Fragment>

<!-- removed other fragments because they didn't matter -->

    <Fragment>
        <util:RegistrySearchRef
            Id="NETFRAMEWORK45" />

        <WixVariable
            Id="WixMbaPrereqPackageId"
            Value="NetFx48Redist" />
        <WixVariable
            Id="WixMbaPrereqLicenseUrl"
            Value="$(var.NetFx48EulaLink)"
            Overridable="yes" />
        <WixVariable
            Id="NetFx48RedistDetectCondition"
            Value="NETFRAMEWORK45 &gt;= $(var.NetFx48MinRelease)"
            Overridable="yes" />
        <WixVariable
            Id="NetFx48RedistInstallCondition"
            Value=""
            Overridable="yes" />
        <WixVariable
            Id="NetFx48RedistPackageDirectory"
            Value="redist\"
            Overridable="yes" />

        <PackageGroup
            Id="NetFx48RedistPayload">
            <ExePackage
                InstallCommand="/q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx48RedistLog].html&quot;"
                RepairCommand="/q /norestart /repair /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx48RedistLog].html&quot;"
                UninstallCommand="/uninstall /q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx48RedistLog].html&quot;"
                PerMachine="yes"
                DetectCondition="!(wix.NetFx48RedistDetectCondition)"
                InstallCondition="!(wix.NetFx48RedistInstallCondition)"
                Id="NetFx48Redist"
                Vital="yes"
                Permanent="yes"
                Protocol="netfx4"
                LogPathVariable="NetFx48RedistLog"
                Compressed="yes"
                SourceFile=".\Files\ndp48-x86-x64-allos-enu.exe" />
              
        </PackageGroup>
    </Fragment>
</Wix>