'DefineConstants in addition to existing ones in csproj
It seems like if I have a csproj file like the following, I end up with BAR defined and FOO not defined.
<PropertyGroup>
<DefineConstants>FOO</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<DefineConstants>BAR</DefineConstants>
</PropertyGroup>
Is there a syntax for "Define additional constants" so that I can use it and end up with both FOO and BAR defined?
I am aware that in this contrived example, I could just have
<PropertyGroup>
<DefineConstants>FOO BAR</DefineConstants>
</PropertyGroup>
But my actual use case is more complicated. I really need to be able to define a constant in addition to whatever was set before.
Solution 1:[1]
This does it:
<PropertyGroup>
<DefineConstants>FOO</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<DefineConstants>$(DefineConstants);BAR</DefineConstants>
</PropertyGroup>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | William Jockusch |
