WiX - harvest non project assemblies in setup output

5.9k views Asked by At

I'm using WiX 3.5 in VS 2010, and I've added all of the project assemblies as references in the Setup project (.wixproj), and set the Harvest property to True so that the binaries, content, and satellites are included in the .msi file.

However, how would I go about adding any third party assemblies (.dlls) to the .msi output? Do I need to add each explicitly to the Product.wxs file, or is there a nicer way? Ideally, I'd like to add them as file references in the Setup project, but this doesn't seem to be an option?

2

There are 2 answers

3
Elmar de Koning On BEST ANSWER

Yes you will need to add them manually to some wxs file OR you can use a pre-build step that uses heat to harvest these file for you (assuming all these file reside in a seperate directory).

Heat is part of Wix and can harvest an entire directory using the dir switch. Depending on the commandline arguments, it will produce a seperate wxs file containing a single ComponentGroup. Just reference this ComponentGroup from the product.wxs.

For an example on how I currently use heat to harvest my release directory:

heat dir "../../bin/release" -gg -cg CG.ApplicationBinaries -dr INSTALLDIR -scom -sfrag -sreg -srd -var var.BuildOutputDir -o ApplicationBinaries.wxs

This will produce the file ApplicationBinaries.wxs:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="INSTALLDIR">
            <Component Id="cmp53F90D1335DD67504EC2B9E1E8620DD3" Guid="{CA2DF1B5-7B20-4596-84A4-925B4F9BA6EC}">
                <File Id="filC65F9CB88694FCA79FCB3CADB9481921" KeyPath="yes" Source="$(var.BuildOutputDir)\AsyncTCPsocket.dll" />
            </Component>
            ....
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="CG.ApplicationBinaries">
            <ComponentRef Id="cmp53F90D1335DD67504EC2B9E1E8620DD3" />
            ...
        </ComponentGroup>
    </Fragment>
</Wix>
0
David Keaveny On

There is currently a bug in Heat which is used by the WiX installer project that means referenced assemblies of a project are not automatically harvested. You'll probably have to wait for version 4 before it gets addressed.

In the meantime, @Elmar de Koning's answer will probably be the best for now.