在 MSBuild 中,您可以通过将项目组传递给目标来数据驱动目标依赖关系,如下所示:
<ItemGroup>
<FullBuildDependsOn Include="Package;CoreFinalize"
Condition="@(FullBuildDependsOn) == ''" />
</ItemGroup>
<Target Name="FullBuild"
DependsOnTargets="@(FullBuildDependsOn)" />
如果您不覆盖FullBuildDependsOn
项目组,则 FullBuild 目标默认取决于 Package 和 CoreFinalize 目标。但是,您可以通过定义自己的 FullBuildDependsOn 项目组来覆盖它。
我想在 psake 中做同样的事情 - 例如:
properties {
$FullBuildDependsOn = "Package", "CoreFinalize"
}
task default -depends FullBuild
# this won't work because $FullBuildDependsOn hasn't been defined yet - the "Task" function will see this as a null depends array
task FullBuild -depends $FullBuildDependsOn
我需要做些什么来数据驱动 psake 中的任务依赖关系?