How to add a whole directory or project output to WiX package

WixInstallationBuild AutomationParaffin

Wix Problem Overview


We decided to switch from VS integrated setup to WiX.

However, what we currently do is use projects output files as the input for the setup project. This lets us easily add Application Files to a directory (for images, samples, and other resources...) and those files are automatically added to the setup when we build.

I could not find any similar feature in WiX. WiX seems to require one Directory entry and one File entry for each and every directory and file. This would require us to change the WiX source everytime a file is added which, to my eyes, is prohibitive since we have so many of them.

Is there any integrated way of doing that with WiX or do I have to write my own task that will create a WiX source before calling candle?

Wix Solutions


Solution 1 - Wix

For WiX 2.0, tallow is very limited; paraffin and mallow offer additional functionality. For WiX 3.0, heat offers the same functionnality as tallow, a little bit better.

In my case I've used mallow source and modified a bit and used it, because paraffin needs 3.5 version of .Net.

You can use Mallow

or Paraffin tool to generate WiX fragments: Getting started, The pain of WiX, A better tallow, Paraffin, Download, Paraffin for WiX 3.0

Solution 2 - Wix

I've been using heat.exe in WIX 3.5 just for that purpose. Last time I checked though, the documentation wasn't up-to-date with 3.5 release so keep that in mind.

Here is an example:

> "$(WIX)bin\heat.exe" dir > "$(SourcePath)" -cg MyFiles -gg -scom > -sreg -sfrag -dr INSTALLDIR -out "$(ProjectDir)Fragments\FileFragment.wxs" > -var wix.InstallerPath

Solution 3 - Wix

The MapGuide Open Source project is currently using John Robbins' Paraffin 3.0 as others have pointed to.

Basically, the first time through for a given release version, we'll run our installer script with a "generate" action that creates new .wxs files for source folder with specific options for each one.

On subsequent builds of the same version, the "regen" action is called to ensure that the .wxs files are updated with any new files/directories that have been added.

I believe that Heat v3 also now allows you to do a lot (or maybe all?) of this, as Brian Rogers writes . I still feel more comfortable with the way that Paraffin does this more explicitly by maintaining static GUIDs, but the current Heat looks like a good option.

Solution 4 - Wix

After further research, it seems there is an included binary called tallow.exe that does just that. It creates a fragment from a directory by recursively searching for files.

Solution 5 - Wix

In my use of WIX, I have never come across a feature that lets you add a whole directory of files at a time. This is because there are many ways a given file can be used (the system doesn't know if you'll later want to refer to a specific file in that folder, etc... and it needs to know them), and also because the install itself needs to be pretty specific.

That doesn't stop you from writing your own frontend for WIX that will generate the WIX XML file (or portions of it) after parsing through a directory structures' contents. That's basically what one of the systems we use at my work does. It's the same idea as any code or text file generation utility. Just traverse through the tree, and generate the appropriate text.

EDIT: In that way, you can consider WIX to be the "low-level language" for defining the setup, and your utility as the "high-level language". If you need help writing one, let us know.

Also, you can have the WIX file be generated as part of the build process by adding this utility to the custom build steps in VStudio. That way you don't actually have a "saved WIX file" that anyone builds, the system just builds it at the end, automatically taking new files into account at the post-build step.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCoincoinView Question on Stackoverflow
Solution 1 - Wixsundar venugopalView Answer on Stackoverflow
Solution 2 - WixstankovskiView Answer on Stackoverflow
Solution 3 - WixJasonBirchView Answer on Stackoverflow
Solution 4 - WixCoincoinView Answer on Stackoverflow
Solution 5 - WixEdgarVeronaView Answer on Stackoverflow