Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include all files in a specific directory into msi package

Tags:

wix

I've got a directory containing multiple files that I want to include in my msi package build by a Wix project.

/database
/database/migration11.txt
/database/migration21.txt
/database/migration32.txt

Those files change often or there are new ones added, and I don't want to adapt my Wix file with every new migration file.

Basically I want to say in my wxs file to include all files in the directory database and upon installation put them in the directory [INSTALLLOCATION]/database.

Any way to achieve this?

ADDED:

Just found this workaround: use HEAT but I'm curious if there is another, recommended way.

like image 728
nabulke Avatar asked Mar 01 '12 09:03

nabulke


2 Answers

You can use task in your wixproj file:

<ItemGroup> 
... Your wxs files ...
<HarvestDirectory Include="$(variable)\YourDirectory\">
  <ComponentGroupName>CG_YOUR_GROUP</ComponentGroupName>
  <DirectoryRefId>DIR_REFERENCE</DirectoryRefId>
  <AutogenerateGuids>false</AutogenerateGuids>
  <GenerateGuidsNow>false</GenerateGuidsNow>
  <SuppressUniqueIds>true</SuppressUniqueIds>
  <SuppressCom>true</SuppressCom>
  <SuppressRegistry>true</SuppressRegistry>
  <SuppressRootDirectory>true</SuppressRootDirectory>
  <PreprocessorVariable>var.Property_Preprocessor</PreprocessorVariable>
</HarvestDirectory>
</ItemGroup>

This task calls Heat during the build. Hope this helps you.

like image 173
Vladimir P Avatar answered Nov 16 '22 12:11

Vladimir P


If anyone still needs this, here is a sample of HarvestDirector with wixproj. Thanks to DavidEGrayson.

like image 43
Rajiv Avatar answered Nov 16 '22 11:11

Rajiv