Include all files in a specific directory into msi

2020-05-27 03:53发布

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.

标签: wix
2条回答
smile是对你的礼貌
2楼-- · 2020-05-27 04:11

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.

查看更多
够拽才男人
3楼-- · 2020-05-27 04:17

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

查看更多
登录 后发表回答