将特定目录中的所有文件包含在msi包中

nab*_*lke 10 wix

我有一个包含多个文件的目录,我希望将其包含在由Wix项目构建的msi包中.

/database
/database/migration11.txt
/database/migration21.txt
/database/migration32.txt
Run Code Online (Sandbox Code Playgroud)

这些文件经常更改或添加了新文件,我不想让我的Wix文件适应每个新的迁移文件.

基本上我想在我的wxs文件中说包含目录数据库中的所有文件,并在安装时将它们放在目录中[INSTALLLOCATION]/database.

有没有办法实现这个目标?

添加:

刚刚找到了这个解决方法:使用HEAT,但我很好奇是否有另一种推荐方式.

小智 14

您可以在wixproj文件中使用任务:

<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>
Run Code Online (Sandbox Code Playgroud)

此任务在构建期间调用Heat.希望这对你有所帮助.


小智 5

如果有人仍然需要这个,这里有一个带有 wixproj 的 HarvestDirector 示例。感谢大卫·格雷森