如果$(ConfigurationName)在<AfterBuild>
<Target Name="AfterBuild">
if $(ConfigurationName) == Release (
<Exec Command="grunt karma:unit --no-color > grunt-karma-output.txt" IgnoreExitCode="true" />
<Exec Command="type grunt-karma-output.txt" CustomErrorRegularExpression=".*mPhantomJS.*FAILED" IgnoreExitCode="false" />
)
</Target Name="AfterBuild">
如果$(ConfigurationName)在<PostBuildEvent>
<PostBuildEvent>
if $(ConfigurationName) == Release (
<Exec Command="grunt karma:unit --no-color > grunt-karma-output.txt" IgnoreExitCode="true" />
<Exec Command="type grunt-karma-output.txt" CustomErrorRegularExpression=".*mPhantomJS.*FAILED" IgnoreExitCode="false" />
)
</PostBuildEvent>
有人可以建议如何在AfterBuild
?
答案 0 :(得分:7)
在目标上使用条件:
<Target Name="AfterBuild" Condition="$(Configuration)==Release">
<Exec Command="echo AfterBuild"/>
</Target>
顺便说一下,这对PostBuildEvent也有同样的作用(你发布的代码肯定不工作)。
<PropertyGroup Condition="$(Configuration)==Release">
<PostBuildEvent>echo PostBuild</PostBuildEvent>
</PropertyGroup>