I have this Msbuild code:
<Import Project="A.proj" Condition="$(BuildDefinition) =='Dist Staging to Dev' Or $(BuildDefinition) =='Dist Staging to Dev(Services Only)'"/>
But I was wondering if is there anything similar to check if an string contains some text to get something similar to:
<Import Project="A.proj" Condition="$(BuildDefinition) CONTAINS 'Dist Staging to Dev'"/>
A target element can have both Inputs and Outputs attributes, indicating what items the target expects as input, and what items it produces as output. If all output items are up-to-date, MSBuild skips the target, which significantly improves the build speed. This is called an incremental build of the target.
MSBuild lets you set properties on the command line by using the -property (or -p) switch. These global property values override property values that are set in the project file. This includes environment properties, but does not include reserved properties, which cannot be changed.
If you use MSBuild 4, you could use Property function
<Import Project="A.proj" Condition="$(BuildDefinition.Contains('Dist Staging to Dev'))"/>
(More info on Property function)
MSBuild4: As Julien said, in MSBUILD 4 is possible to user Property Function.
MSBuild 3.x: In previous versions is possible if you use Tigris MsBuild Tasks
You can use task RegexMatch and use a regular expression
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