3

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.

Community
  • 1
  • 1
Brock Hensley
  • 3,617
  • 2
  • 29
  • 47

1 Answers1

7

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;
}
Community
  • 1
  • 1
Stephen Jennings
  • 12,494
  • 5
  • 47
  • 66
  • I tried that but the `OnResolveSource` method is never fired (debug breakpoint never gets there) – Brock Hensley Sep 24 '13 at 12:10
  • I suggest double-checking this route. Inspecting [apply.cpp](http://wix.codeplex.com/SourceControl/latest#src/burn/engine/apply.cpp) shows that between the `w343` and `e054` log lines is the call to `pUX->pUserExperience->OnResolveSource`, so your BA should be receiving this event. – Stephen Jennings Sep 24 '13 at 17:50
  • i have one important question, why WIX documentation is simply not mentioning this? I was fighting with this last couple of days.... thank you so much for this – bzyku Mar 02 '22 at 13:28