Reusing WIX components to speed up candle/light
Asked Answered
I

1

8

I am fairly new to WIX, so forgive me if I'm completly missing the boat here, but I was wondering if it was possible to reuse components (mwm,cab,etc) from within a wxs file without having light re-link them every time. The installer I'm working on has several executables, dlls and config files that tend to change between each install. These files amount to about 5 meg worth of installer. The part I want to reuse is the ~350 meg worth of image/map/database files that do not change very often that I don't want to necessarilly have to compile/link every time the installer is built.

I've tried creating a mwm file for the maps, but when I reference them within the wxs, they get linked via light into the main .msi file. I've tried specifing a non embedded CAB file to hold the maps:

<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Media Id="2" Cabinet="NewRiver.cab" EmbedCab="no" CompressionLevel="none" />
...
<Merge Id="NewRiverDigMap" SourceFile="..\Output\NewRiverDigitalMaps.msm" Language="1033" DiskId="2" />

But every time light runs, the stand-alone CAB file gets regenerated - which takes a while.

I thought about just creating a ZIP file to deliver along with the msi and have the installer just kick off the zip extract, but that seems anti-wix to me. I'd like to have the files be removed when they are no longer needed.

Are there any other wix like operations that I'm missing? I've read about fragments, but that doesn't seem to be what I'm looking for.

Thanks, David

Iolite answered 30/7, 2009 at 14:35 Comment(0)
B
12

Your intuition is absolutely leading you in the right direction. The feature you are looking for is called "cab-cache". You use it by adding the following to your light.exe command-line:

-reusecab -cc path\to\directory\for\cabinets

Note: Compiling (candle.exe) and linking (first half of light.exe) should happen very quickly. What is usually slow is the binding (second have of light.exe) because it actually touches all of the files and builds the cabinets. Cabinet building is the slowest part, so hopefully the cab-cache speeds things up sufficiently for you.

P.S.: If compiling is taking much time you can create ".wixlib" with lit.exe. I have more about .wixlibs here: http://robmensching.com/blog/posts/2008/10/10/What-are-.wixlibs-and-why-would-you-use-them

Bratton answered 30/7, 2009 at 23:33 Comment(3)
Eureka! Just what I was looking for. Doesn't seem to work if the cabinets are NOT embedded though - somehow light deletes the .cab file then goes looking for it. Ideally, I'd like it to work with non-embedded cabinets, but it certainly is a bit faster than before.Iolite
Hmm, that behavior sounds like a bug. Would you mind opening a bug (wix.sourceforge.net) with details. We should be able to fix in in WiX v3.5.Bratton
Thank you for the great tip (docs)! In my case it reduced the time for building the msi package from about 50s to only 10s (~200 files/~100MB).Flexor

© 2022 - 2024 — McMap. All rights reserved.