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 = Result.Ok; } };
We check if the package has a DownloadSource
attribute and if it does, we set the Result
property to Result.Download
. This will allow the download...