MSBuild property set in target is not visible in parent target -


here targets file

<?xml version="1.0" encoding="utf-8"?> <project defaulttargets="buildapp" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" toolsversion="12.0"> <propertygroup>   <testinitresult>false</testinitresult> </propertygroup>  <target name="buildapp">   <calltarget targets="testinit" continueonerror="true"/>    <message importance="high" text="2 value of flag: $(testinitresult)"/>   <calltarget targets="target2" />   <calltarget targets="runbuild" condition="'$(testinitresult)'=='true'"/> </target>  <target name="testinit">   <propertygroup>     <testinitresult>true</testinitresult>   </propertygroup>   <message importance="high" text="1 value of flag: $(testinitresult)"/> </target>   <target name="target2">   <message importance="high" text="inside run target2"/> </target>  <target name="runbuild">     <message importance="high" text="inside run build"/> </target>  </project> 

output of msbuild:

d:\cqf>msbuild build.targets microsoft (r) build engine version 12.0.30501.0 [microsoft .net framework, version 4.0.30319.34209] copyright (c) microsoft corporation. rights reserved.  build started 7/31/2015 4:38:49 am. project "d:\cqf\build.targets" on node 1 (default targets). testinit:   1 value of flag: true buildapp:   2 value of flag: false target2:   inside run target2 done building project "d:\cqf\build.targets" (default targets).   build succeeded.     0 warning(s)     0 error(s)  time elapsed 00:00:00.06 

the value of testinitresult set in target "testinit" not visible in target "buildapp" when returns.

please let me know how make testinitresult visible in parent target. or there better approach achieve required result.

what want achieve is, first testinit target should run, target2 should run, , target runbuild should run if testinit successful. if testinit failed, run target2, skip runbuild.

thank you.


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -