Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if a target exists or not before calling it?

Tags:

msbuild

Is there a way to check the existence of a target so that we can call it only when it exists?

like image 720
Nam G VU Avatar asked Mar 25 '10 14:03

Nam G VU


1 Answers

You can make a Target depend on a other Target

...

<Target Name="Two" DependsOnTargets="One">
    <Message Text="... comes Two." />
</Target>

<Target Name="One">
    <Message Text="After One ..." />
</Target>
...

Your recent posts show that you try heavily to rely on calling Targets which is - as far as i understand it - against the philosophy of MSBuild.

Try rather to model dependencies between your Targets.

like image 145
Filburt Avatar answered Oct 21 '22 05:10

Filburt