Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Skipping MSBuild target

Tags:

msbuild

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.

like image 531
jco Avatar asked Jul 09 '10 10:07

jco


1 Answers

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

like image 161
zbynour Avatar answered Oct 13 '22 00:10

zbynour