Add a folder to installer in wix not files?
Asked Answered
T

1

5

My installer has to copy files into installdir... My application has around 2000 files and it is not possible for me to write the script to add each and every file to the installer. Is there any option in wix so that I can add all the files or the entire folder consisting the files at once? I am new to wix and i didnt find any option in any tutorial for this... Please do assist me and thanks in advance.....

Trickster answered 20/6, 2012 at 13:48 Comment(0)
O
13

Heat is the WiX harvest tool. You can run it on a directory to generate the necessary WiX source code.

EDIT: If you want to run heat before your VS project builds, add it to your project prebuild events as seen in the screenshot below (this is how I have my project setup to dynamically generate WiX source for our ever changing help content): VS Build Events

Note the -var wix.HelpSource switch that I have. The WiX source files generated by heat will set the location of the source files to that variable instead of hard-coding it. So the generated source will have components that look something like this:

<Component Id="Welcome.htm" Directory="Content" Guid="INSERT-GUID-HERE">
  <File Id="Welcome.htm" KeyPath="yes" Source="!(wix.HelpSource)\Content\Welcome.htm" />
</Component>

And in my particular case, I define that variable on the Tool Settings screen of my WiX VS project to the relative directory ..\..\Help\Output as seen below: enter image description here

NOTE: Harvesting files in this manner will cause the GUIDs of the components harvested to change every time you build. If you don't want your GUIDs to change, you may have to write some wrapper that calls heat to harvest the files, then updates your original WiX source, leaving all the GUIDs alone.

Otis answered 20/6, 2012 at 13:59 Comment(3)
If you are using wix within a VS project, call the heat harvest tool in the PreBuild section of the wixproj. That way every time you build it will re-generate without any manual intervention.Athos
can you help me how to do that in vs?Trickster
@user1357950 I updated my answer to show how to run heat as a pre-build event in visual studio, per caveman_dick's suggestionOtis

© 2022 - 2024 — McMap. All rights reserved.