dushyantp
dushyantp

Reputation: 4720

Run msbuild task with an external condition

Is it possible to ignore a target in a proj file? Anything of the sort of

msbuild amazingproject.proj /IgnoreTarget:TimeConsumingTarget

or can we set a condition value for the target while calling msbuild?

msbuild amazingproject.proj /Variable:TimeConsumingCondition=False

& in the proj file we can have

<targed name="TimeConsumingTarget" Condition="$(Variable:TimeConsumingCondition)"=="True">

Any other suggestion that works?

The whole story: We have many developers, some of whom need this target to run and some don't. So we need a conditional call for the target.

Upvotes: 0

Views: 857

Answers (1)

stijn
stijn

Reputation: 35901

Just look at the documentation of Target.

Project:

<Target Name="TimeConsumingTarget"
        Condition="'$(BuildTimeConsumingTarget)'=='True'">

Invoked like:

msbuild amazingproject.proj /p:BuildTimeConsumingTarget=false

Upvotes: 4

Related Questions