I am totally new to the functions and conditions in .csproj files so any and all help is appreciated.
What I want to do is check for a specific compiler directive in the current configuration. An example would be something like the following:
<Choose>
<When Condition= [current configuration has CONST-1 compiler constant defined] >
...
</When>
<When Condition= [current configuration has CONST-2 compiler constant defined] >
...
</When>
</Choose>
I don't know if this is even possible or not. If there is a better way to do what I am asking let me know that as well. Either way, I want to test for a condition independent of the configuration.
EDIT
What I really want is a value that I can edit easily, preferrably within Visual Studio, that I can also check regargless of the configuraiton. I thought about compiler constants because you can easily change them in the Project Properties in VS.
Property
element. Your csproj file will already have conditionalPropertyGroup
elements, depending on the configuration. Inside them, you can add new customProperty
elements, and you can test them in the usual way in yourCondition=
attribute. Would that work for you, or do you really need compiler directives? They're more complicated, because there are various ways in which they could be defined. – Beverie