wixtoolset / issues

WiX Toolset Issues Tracker
http://wixtoolset.org/
130 stars 24 forks source link

Cache events returns wrong action type #8702

Closed petm2022 closed 3 months ago

petm2022 commented 3 months ago

WiX Version

5.0.0

.NET or MSBuild or Visual Studio Version

VS 2022 17.10.3

HeatWave Version

1.0.4

Windows Version

Win10 22H2

Repro Repo

No response

Repro Steps

Add a function like this in you managed bootstrapper:

private void OnCacheAcquireBegin(object sender, CacheAcquireBeginEventArgs e)
{
       Log(LogLevel.Standard, "---- OnCacheAcquireBegin:     Package Id: " + e.PackageOrContainerId + ", Action: " + e.Action);
}

Actual Result

I have a managed bootstrapper application installing several msi packages. I need to know if the packages are copied from desk, from removable media or downloaded. For that I read the Action attribute returned by CacheAcquireBegin. The valued returned, when installing from desk or usb is CacheOperation:None I have tried all the other Cache function but it is the same, except CacheAcquireResolving:

[0CD0:058C][2024-08-16T13:42:54]i000: ---- OnCacheAcquireBegin:     Package Id: Media, Action: None
[0CD0:058C][2024-08-16T13:42:54]i000: ---- OnCacheAcquireResolving: Package Id: Media, Action: Local
[0CD0:0BCC][2024-08-16T13:42:54]i338: Acquiring package: Media, payload: Media, copy from: C:\Users\WDAGUtilityAccount\Desktop\MyApp\Data2\Media.msi
[05FC:0798][2024-08-16T13:42:54]i305: Verified acquired payload: Media at path: C:\ProgramData\Package Cache\.unverified\Media, moving to: C:\ProgramData\Package Cache\{22843ADF-4665-4D61-8BA5-DA0BE6AFBBD9}v21.0.16\Data2\Media.msi.
[0CD0:058C][2024-08-16T13:42:54]i000: ---- OnCacheVerifyComplete:   Package Id: Media, Action: None
[0CD0:058C][2024-08-16T13:42:54]i000: ---- OnCachePackageComplete:  Package Id: Media, Action: None

Expected Result

I did expect the action valued returned was CacheOperation:Copy at least when installing from desk or usb.

It worked as expected when my application was build with Wix 3.11

Acknowledgements

barnson commented 3 months ago

OnCacheAcquireBegin lets the BA specify the cache operation; it's always None on input. OnCacheAcquireResolving takes the value the BA specified and turns that into a resolve operation (e.g., local, download). WiX v3 did that in one operation.