MSBuild 条件执行? [英] MSBuild conditional Exec?
问题描述
我正在使用 <MSBuild Projects="... 标记构建各种项目.然后在构建项目后执行一些命令行工具.
例如
<目标名称="名称"><MSBuild 项目=""/><执行命令=""/></目标>
我注意到该项目仅根据需要构建,并在运行构建脚本时获得以下输出:跳过目标CoreCompile",因为所有输出文件都是最新的".这很好,但我如何让我的 <Exec... 命令使用相同的条件,以便它们也只在必要时运行?
更新:我已经实施了 gregmac 的建议,但无论如何它仍在执行命令.这就是我现在得到的:
<目标名称="名称"><MSBuild 项目=""><输出TaskParameter="TargetOutputs" ItemName="AssembliesBuiltByChildProjects"/></MSBuild><Exec Command="" Condition="'@(AssembliesBuiltByChildProjects)'!=''"/>
非常感谢任何进一步的帮助.这对我来说有点棘手.
感谢任何提示.
艾伦
我确实设法找到了满足我需求的解决方案,尽管它可能不是最佳解决方案.
在此处查看我对其他问题的回答:MSBuild Post-Buildp>
谢谢,艾伦
I am building various projects using the <MSBuild Projects="... markup. I am then executing some command line tools after the project is built.
E.g
<Target Name="Name">
<MSBuild Projects="" />
<Exec Command="" />
</Target>
I notice that the project is only built as required and get the following output when the build script is run: "Skipping target "CoreCompile" because all output files are up-to-date". This is great but how do I make my <Exec... commands use the same condition so that they are only run when necessary as well?
Update: I've implemented gregmac's suggestion but its still executing the command regardless. This is what I've got now:
<Target Name="Name">
<MSBuild Projects="">
<Output TaskParameter="TargetOutputs" ItemName="AssembliesBuiltByChildProjects" />
</MSBuild>
<Exec Command="" Condition="'@(AssembliesBuiltByChildProjects)'!=''" />
Any further help is much appreciated. This is a bit of a sticking point for me.
Thanks for any tips.
Alan
I did manage to find a solution to fit my needs although it may not be the optimal solution.
See my answer to my other question here: MSBuild Post-Build
Thanks, Alan
这篇关于MSBuild 条件执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!