好像我有一个如下所示的csproj文件,我最终定义了BAR并且没有定义FOO。
<PropertyGroup>
<DefineConstants>FOO</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<DefineConstants>BAR</DefineConstants>
</PropertyGroup>
是否有“定义附加常量”的语法,以便我可以使用它并最终定义FOO和BAR?
我知道在这个人为的例子中,我可以拥有
<PropertyGroup>
<DefineConstants>FOO BAR</DefineConstants>
</PropertyGroup>
但我的实际用例更复杂。除了之前设置的内容之外,我真的需要能够定义一个常量。
答案 0 :(得分:4)
这样做:
<PropertyGroup>
<DefineConstants>FOO</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<DefineConstants>$(DefineConstants);BAR</DefineConstants>
</PropertyGroup>