5

I have Condtional Compilation Symbols in a C# project defined as "ABC;XYZ", and I can use the following in the project XML file for conditional include of project code files during MSBuild:

<Compile Include="SomeFile.cs" Condition="$(DefineConstants)'=='ABC;XYZ'"/>

But I need something like the following which does NOT work:

<Compile Include="SomeFile.cs" Condition="$(DefineConstants)'=='ABC'"/>

Is it possible to use just one of the defineconstants for condition test?

EmbeddedDude
  • 171
  • 8

1 Answers1

6

I figured it out... this link helped.

Essentially you just have to look into the string to see if it contains whichever tag you want to base your condition on. In my case this was the code for it:

<Compile Include="SomeFile.cs" Condition="$(DefineConstants.Contains('ABC'))" />
Community
  • 1
  • 1
EmbeddedDude
  • 171
  • 8