I've seen some answers to a similar question but not exactly the same and not with positive luck trying to use suggested solutions... so I'm trying something like this:
<project>
<target name="foo" Condition="'$(Configuration)' == 'Debug' ">
<Message Text="=== RUNNING FOO DEBUG TARGET ===" />
</target>
<target name="foo" Condition="'$(Configuration)' == 'Release' ">
<Message Text="=== RUNNING FOO RELEASE TARGET ===" />
</target>
</project>
... but I'm finding that it doesn't appear to be possible to have two targets with the same name working properly under these conditions. One will negate the other.
How can I do this?
Provide a wrapper target, that depends on both targets. The both will be called, but only the one matching the condition will actually do something.
<Project>
<Target Name="foo" DependsOnTargets="_fooDebug;_fooRelease"/>
<Target Name="_fooDebug" Condition="'$(Configuration)' == 'Debug' ">
<Message Text="=== RUNNING FOO DEBUG TARGET ===" />
</Target>
<Target Name="_fooRelease" Condition="'$(Configuration)' == 'Release' ">
<Message Text="=== RUNNING FOO RELEASE TARGET ===" />
</Target>
</Project>
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