I am very new to MSBuild, and itβs hard for me to figure out how to build a PropertyGroup record from conditional parts.
Here is what I have that doesn't work:
<ItemGroup> <CompilerDirective Include="DEBUG_PARANOID" Condition=" '$(SomeFlag)' == 'true' "/> <CompilerDirective Include="DEBUG"/> <CompilerDirective Include="TRACE"/> </ItemGroup> <PropertyGroup> ... <DefineConstants>@(CompilerDirective)</DefineConstants> ... </PropertyGroup>
I would like the constants that were defined as DEBUG_PARANOID, DEBUG; TRACE if SomeFlag is set to true, leaving DEBUG_PARANOID if not. This is for .csproj, by the way.
If I print @ (CompilerDirective) with a message task, it works.
My question is how to make this work inside a PropertyGroup record?
scobi source share