Our application always depends on some runtime, for example ".net framwork", ".net core hosting bundle", "IIS". That would be great if our installation package can install that necessary runtime automatically when detecting it hasn't been installed.
Create a WiX Bootstrapper project, which contains Bundles.wxs file.
<Bundle Name="RiskSpectrum SDP Web 1.1.1" Version="$(var.ProductVersion)" Manufacturer="Riskspectrum AB" UpgradeCode="ce324ddd-01b2-4cb0-989d-48d4f67c0f91"> <BootstrapperApplicationRef Id="WixBootstrapperApplication.HyperlinkLicense"> <bal:WixStandardBootstrapperApplication LogoFile="$(var.SDPWebSetup.ProjectDir)\Resources\logo.png" LicenseUrl="" SuppressOptionsUI="yes"/> </BootstrapperApplicationRef> <Chain> <!-- TODO: Define the list of chained packages. --> <!-- <MsiPackage SourceFile="path\to\your.msi" /> --> <PackageGroupRef Id="InstallIIS"/> <PackageGroupRef Id="NetCoreHostingBundle"/> <MsiPackage Id="SDPWebInstaller" SourceFile="$(var.SDPWebSetup.TargetPath)" Compressed="yes" DisplayInternalUI="yes"/> </Chain> </Bundle> <Fragment> <util:RegistrySearch Variable="FindHostingBundle" Root="HKLM" Key="Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Updates\ .NET Core\Microsoft .NET Core 2.2.8 - Windows Server Hosting (x64)" Value="PackageName"/> <PackageGroup Id="NetCoreHostingBundle"> <ExePackage Id="NetCoreHostingBundleExe" SourceFile="$(sys.SOURCEFILEDIR)\Packages\dotnet-hosting-2.2.8-win.exe" Cache="no" Compressed="no" Vital="no" InstallCommand="/q /ACTION=Install" RepairCommand="/q ACTION=Repair" InstallCondition="NOT FindHostingBundle" DownloadUrl="https://dotnet.microsoft.com/en-us/download/dotnet /thank-you/runtime-aspnetcore-2.2.8-windows-hosting-bundle-installer"/> </PackageGroup> </Fragment>
Some comments about code above.
The installation chain is, Setup IIS(if not installed) -> Install dotnet core hosting bundle(if not installed) -> Install SDP
Use RegistrySearch to search if ".net Core Hosting Bundle" has been installed, if can't find the registry, will install it, otherwise skip it.
Compressed="no" means will not compress "dotnet-hosting-2.2.8.win.exe" inner the installation package, will as a unique package, if not exist, will use "DownloadUrl" to download it.
Building Installation Package Bundles
MsiPackage Element