Downloading packages

As we saw in the previous chapter, we can download a package from the Internet or a local network, as in the following example where we use the NetFx40Web package from WixNetFxExtension to download the .NET Framework:

<Chain>
   <PackageGroupRef Id="NetFx40Web"/>
   <MsiPackage SourceFile="Lib\MyInstaller.msi" />
</Chain>

In order for our custom UI to allow this download to proceed, we must handle the ResolveSource event. The following is an example that uses an anonymous method in our viewmodel's constructor:

this.model.BootstrapperApplication.ResolveSource += (sender, args) => { if (!string.IsNullOrEmpty(args.DownloadSource)) { // Downloadable package found args.Result = Result.Download; } else { // Not downloadable args.Result ...

Get WiX 3.6: A Developer's Guide to Windows Installer XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.