Search code examples
wixbundlebootstrapperburn.net-4.8

WIX Burn Bootstrapper, installing .net framework as payload


What I want to do:

Make a wix burn bundle bootstrapper that 1st installs the .net 4.8 framework if necessary and then after that, install our custom MSI the custom MSI is all good and working.

I want a single file, which I understand will be 100,000 K big and we're fine with that (once you package in the .net 4.8 installer)

Then just have the bootstrapper auto unpackage and run the .net framework install if needed, but everything I've tried doesn't work. Either it wants to download it (we don't want to count on internet access), or a Open File Dialog shows wanting to get pointed to the .net framework install.

all code below:

<?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>

And I've copied and altered the .net 4.8 version of wix code from and made some customizations:

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>

Solution

  • I never found this this on any google hunts, but apparently setting the compressed to "yes" was the key, and no need for a payload when doing that. Worked exactly as I want at this point. Single (large) file and auto-extracts and runs.

    <?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>