tags:

views:

28

answers:

1

Is there a way to use MSBuild syntax to skip a specific target? I have a file consisting of a lot of properties (lines containing /property:X=Y) that I want to pass on to a recursively called instance of MSBuild, but this file also contains a /target:X line, that I do not want to have any effect. I don't have the option to modify the file.

A: 

Hi,

I suppose you are able to edit .proj file. You can manage MSBuild targets executing by the Condition. Your target, which you want to exclude, could contain something like this:

<Target 
    Name="SomeTarget" 
    Condition="'$(SomeProperty)'=='true'" 
    DependsOnTargets="SomeAnotherTarget"/>

SomeProperty can be passed in the calling:

MSBuild.exe build.proj /p:SomeProperty=false

Regards

zbynour