除了csproj中的现有常量之外,还定义了DefineConstants [英] DefineConstants in addition to existing ones in csproj

查看:60
本文介绍了除了csproj中的现有常量之外,还定义了DefineConstants的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个如下所示的csproj文件,则最终我定义了BAR,而FOO没有定义.

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>

是否存在定义其他常量"的语法,以便我可以使用它并最终定义FOO和BAR?

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.

推荐答案

做到这一点:

<PropertyGroup>
  <DefineConstants>FOO</DefineConstants>
</PropertyGroup>
<PropertyGroup>
  <DefineConstants>$(DefineConstants);BAR</DefineConstants>
</PropertyGroup>

这篇关于除了csproj中的现有常量之外,还定义了DefineConstants的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆