Search code examples
wixwixlib

Binary record in a wixlib


Each one of my installers utilize certain temporary exes and dlls. In my WiX project I can put them in the Binary table. Since they're shared across all projects is it possible to put them into a wixlib? What would the syntax be.

I'm doing something similar with properties using the PropertyRef attribute. There is no corresponding BinaryRef attribute to do the same with the Binary table.


Solution

  • There is no corresponding BinaryRef attribute to do the same with the Binary table.

    For elements that don't have a corresponding *Ref element, you can use the following workaround:

    • Create an empty ComponentGroup element (which is valid WiX code) in the fragment.
    • Insert a ComponentGroupRef element where you want to reference the Fragment. This pulls in the whole content of the Fragment, not just the ComponentGroup.

    Example:

    <Fragment>
        <ComponentGroup Id="MyBinaries"/>
        <Binary Id="Binary1" SourceFile="Files\Binary1.xyz"/>
        <Binary Id="Binary2" SourceFile="Files\Binary2.xyz"/>
    </Fragment>
    

    To reference MyBinaries from another .wxs file:

    <Fragment>
        <ComponentGroup Id="SomeComponents">
            <ComponentGroupRef Id="MyBinaries"/>
        </ComponentGroup>
    </Fragment>