if $(ConfigurationName) doesn't work in <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">
if $(ConfigurationName) WORKS in <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>
Could anyone suggest how to check if the build is in release mode in AfterBuild
?
Use a Condition on the target:
<Target Name="AfterBuild" Condition="$(Configuration)==Release">
<Exec Command="echo AfterBuild"/>
</Target>
Btw this also works the same way for the PostBuildEvent (and the code you posted definitely does not work).
<PropertyGroup Condition="$(Configuration)==Release">
<PostBuildEvent>echo PostBuild</PostBuildEvent>
</PropertyGroup>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With