Inside the .csproj there are some constants defined like this:
<DefineConstants>DEBUG;TRACE;ANDROID;GLES;OPENGL;OPENAL</DefineConstants>
Then later in the project there's an itemgroup
<ItemGroup>
<EmbeddedNativeLibrary Include="..\ThirdParty\Dependencies\openal-soft\libs\armeabi-v7a\libopenal32.so">
<Platforms>Android,Ouya</Platforms>
<Link>libs\armeabi-v7a\libopenal32.so</Link>
</EmbeddedNativeLibrary>
<EmbeddedNativeLibrary Include="..\ThirdParty\Dependencies\openal-soft\libs\armeabi\libopenal32.so">
<Platforms>Android,Ouya</Platforms>
<Link>libs\armeabi\libopenal32.so</Link>
</EmbeddedNativeLibrary>
<EmbeddedNativeLibrary Include="..\ThirdParty\Dependencies\openal-soft\libs\x86\libopenal32.so">
<Platforms>Android,Ouya</Platforms>
<Link>libs\x86\libopenal32.so</Link>
</EmbeddedNativeLibrary>
I want this ItemGroup to be included only when the constant OPENAL is defined, regardless of debug or release. How can I do this?
<ItemGroup Condition="XXXXXX" >
What would XXXXXX be?
The syntax for a condition that checks if a Constant is defined is: (in this case OPENAL)
<ItemGroup Condition="$(DefineConstants.Contains('OPENAL'))">
You can also use the <Choose>
element to create conditional blocks in msbuild / .csproj files
if you want to do more sophisticated conditional processing.
http://msdn.microsoft.com/en-us/library/ms164282.aspx
Edited: Angle brackets had disappeared.
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