3
votes

Before I started creating my own custom Managed Bootstrapper Application, I was using the existing Fragment below with no issues, i.e. it would download the .msi from the internet if the local file was not found. Now when I try to execute the MBA I get the error below in the log file.

[Environment]
WiX 3.7, Visual Studio 2012, x64

[Bundle.wxs]

<PackageGroupRef Id="ReportViewer"/>

[Fragment.wxs]

<PackageGroup Id="ReportViewer">
  <MsiPackage DisplayName="Microsoft Report Viewer 2012 Runtime"
              Cache="no" Compressed="no" ForcePerMachine="yes" Permanent="yes" Vital="yes"
              SourceFile="C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bootstrapper\Packages\ReportViewer\ReportViewer.msi"
              DownloadUrl="http://go.microsoft.com/fwlink/?LinkID=217022"
              InstallCondition="(VersionNT >= v6.0 OR VersionNT64 >= v6.0)"/>
</PackageGroup>

[Log]

[14:42]i101: Detected package: ReportViewer.msi, state: Absent, cached: None

[14:54]i201: Planned package: ReportViewer.msi, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: None, cache: Yes, uncache: Yes, dependency: Register

[15:00]w343: Prompt for source of package: ReportViewer.msi, payload: ReportViewer.msi, path: E:\ReportViewer.msi
[15:00]e054: Failed to resolve source for file: E:\ReportViewer.msi, error: 0x80070002.
[15:00]e000: Error 0x80070002: Failed while prompting for source (original path 'E:\ReportViewer.msi').
[15:00]e313: Failed to acquire payload: ReportViewer.msi to working path: C:\Users\POS1User\AppData\Local\Temp{416b9117-e1b4-4518-b13d-eb5416da8794}\ReportViewer.msi, error: 0x80070002.

1

1 Answers

6
votes

When a package is not present locally, the Burn engine asks your bootstrapper application to deal with the ResolveSource call. As explained in this other Stack Overflow answer, you should add your own event handler for the ResolveSource event. You can simply instruct Burn to download the package for you:

this.Bootstrapper.ResolveSource += OnResolveSource;

...

private void OnResolveSource(object sender, ResolveSourceEventArgs e)
    if (!File.Exists(e.LocalSource) && !string.IsNullOrEmpty(e.DownloadSource))
        e.Result = Result.Download;
}