Generate Wix File for Referenced DLLs

I just created a Wix installer for a Windows Application. The application uses DevExpress UI controls, which results in a ton of project references that need to be Gac’d when the installer runs. Since there is no clear way (that I could find) to loop through a directory in Wix, I was facing adding 37 Component elements by hand to my installer files. Luckily I found the Heat tool that comes with Wix.

Heat is a command line tool that, among other useful things, will “harvest” a directory for you, creating an output wxs file that can be used with your installer. Here is the command I used to harvest my app’s bin folder. I ran this from the project (csproj) directory:

"C:\Program Files (x86)\WiX Toolset v3.8\bin\heat.exe" dir ".\bin\Debug" -cg YodaRefs -ag -scom -sreg -sfrag –srd -template fragment -out yodarefs.wxs

Note that you might need to change the program files path above to correspond to your installed version of Wix.

There is a better way to add references automatically in Visual Studio. I didn’t have the time to tinker with VS, so I just copied the output from the command above into my product.wxs file.

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: