Wix Build Order - msbuild&热

时间:2018-05-18 09:53:51

标签: msbuild wix

我正在尝试使用Heat扩展现有的Wix项目,以包含安装程序中另一个项目的输出目录中的所有文件。不知怎的,我错过了一些非常简单的东西,因为我觉得这是一个非常常见的任务。

以下是解决方案的内容:

SomeDependencyA.csproj
SomeDependencyB.csproj (Depends on SomeDependencyA)
WindowsService.csproj (Depends on SomeDependencyB)
Installer.wixproj(Depends on WindowsService.csproj)

Wix基本上应该从WindowsService Output文件夹中获取任何内容,并从中构建msi包。这个过程应该是:

  • 构建所有依赖项
  • 构建WindowsService项目
  • 使用Heat生成一个Fragement
  • 构建安装程序

以下是我的问题:我在哪里/如何包括对热火的召唤? Pre-Build Step和BeforeBuild Target不起作用,因为此时WindowsService和Dependencies尚未构建。 AfterBuild不会有帮助,因为在那时生成的Fragment将不再被消除。我正在寻找一些构建目标,即在构建所有依赖项之后才能进行调用,但是在构建安装程序项目之前。应该很容易,但我还没弄明白。

1 个答案:

答案 0 :(得分:2)

BeforeBuild目标可能会在依赖项目完成构建之前发生。

我过去用于此类构建排序的解决方案是为BeforeBuild目标添加DependsOnTargets;

对于csproj:

<Target Name="BeforeBuild" DependsOnTargets="ResolveReferences">  

对于vcxproj:

<Target Name="BeforeBuild" BeforeTargets="PrepareForBuild">

这将强制项目等到依赖项目完成后再运行BeforeBuild目标。