Is there a neat way to create "boolean" properties to use in MSBuild? I can evaluate the expression inside a Condition
attribute, but not inside the Value attribute of a CreateProperty
task.
I'd like to do something like this:
<CreateProperty Value="'$(IncludeInBuild)'=='' OR
'$([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectFullPath),
$(IncludeInBuild)'=='True'">
<Output TaskParameter="Value" PropertyName="MatchesInclude" />
</CreateProperty>
What that gives me is not True or False, but
''=='' OR '$([System.Text...
Can I evaluate a boolean expression and set a property with the result? My workaround now is just to repeat the expression in Condition attributes wherever I need it.
How about creating a default property 'false' with a condition to assign true if the condition passes?
<PropertyGroup>
<MatchesInclude>false</MatchesInclude>
<MatchesInclude Condition="'$(IncludeInBuild)'=='' OR
'$([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectFullPath),
$(IncludeInBuild)'=='True'">true</MatchesInclude>
</PropertyGroup>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With