这个问题是Using Visual Studio Code and using defined symbols的扩展,但是答案已经过时,我的问题包括一个条件部分。
我有一个.csproj文件。其中包括以下内容:
<PropertyGroup>
<Configurations>Debug;Release;Test</Configurations>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Test'">
<DefineConstants>$(DefineConstants);INCLUDE_TESTS</DefineConstants>
</PropertyGroup>
在tasks.json
的构建任务中,我包含"/property:Configuration=Test",
作为参数。
此组合有效,汇编的文件正确。 但是,VSCode本身无法识别这些常量,会破坏智能感知等。
当我从下拉列表中选择Test
配置时,它确实可以在完整的Visual Studio中工作
使用
-
OmniSharp v1.22.1
-
VSCode 1.46.1
OmniSharp声称支持:https://github.com/OmniSharp/omnisharp-roslyn/issues/226
那么这是VSCode的限制吗?