msbuild - Conditionally exclude project from Visual Studio build -


i have visual studio 2012 library project (vc++) includes classes if sdk available. implemented via msbuild conditions 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

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -