I have a NAnt script like below:
<if test="${a}>${b}">
<call target="target"/>
</if>
What I want is to convert it into MSBuild script. I found that there is tag to write conditions but it is only used for defining property/item.
Can we write 'if' condition in MSBuild? Please help!
Every msbuild task have an optional Condition parameter so you could do this:
<CallTarget Targets="target" Condition="${a} > ${b}"/>
Edit: If you need a condition to execute multiple task, you could repeat the Condition parameter foreach task or you could encapsulate the multiple task call in a target
<Target Name="MultipleCall" Condition="${a} > ${b}">
<CallTarget Targets="targetA"/>
<CallTarget Targets="targetB"/>
</Target>
(The characters < and > must be escaped)
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