msbuild - Conditionally exclude project from Visual Studio build -
i have visual studio 2012 library project (vc++) includes classes if sdk available. implemented via msbuild condition
s in property sheet:
<choose> <when condition="exists('c:\ofed_sdk\')"> <propertygroup> <ofedsdkdir>c:\ofed_sdk\</ofedsdkdir> </propertygroup> </when> </choose> [...] <itemdefinitiongroup condition="$(ofedsdkdir) != ''"> <clcompile> <additionalincludedirectories>$(ofedsdkdir)inc\; %(additionalincludedirectories)</additionalincludedirectories> <preprocessordefinitions>have_ofed_sdk; %(preprocessordefinitions)</preprocessordefinitions> </clcompile> [...]
certain functionality available if have_ofed_sdk
defined. works perfectly.
the solution furthermore contains several projects testing library project. test classes compiled conditionally in separate project.
my question is: can build project depending on whether above-mentioned condition (condition="$(ofedsdkdir) != ''
true
? if so, how that? need solution works when building vs.
edit: aware of solution martin proposed, looking solution working programmatically, ie not allow user enable "wrong" configuration via gui.
edit: found can add (condition="$(ofedsdkdir) != ''
clcompile
of source file achieves want, still runs build process project.
just setup different solution configuration doesn't attempt build relevant projects want exclude.
for example, call "release-no-ofed" , un-tick projects being compiled in configuration.
Comments
Post a Comment