[英]Visual Studio: How to change target framework used by editor?
我有一个多平台解决方案,其中包含许多csproj
文件:
<PropertyGroup>
<TargetFrameworks>net452;netstandard1.4</TargetFrameworks>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.4' ">
<PackageReference Include="System.Net.Http" Version="4.3.0"/>
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
<PackageReference Include="Newtonsoft.Json" Version="6.0.8" />
</ItemGroup>
请注意,我没有TargetFramework
元素(单数形式)。 我只有TargetFrameworks
元素(复数形式)。
编辑器假定netstandard1.4
并且所有#if NET452
块都变灰并且没有IntelliSense。
如何告诉Visual Studio编辑器识别特定的目标框架( net452
, netstandard1.4
),并至少暂时获取IntelliSense?
作为参考,我使用的是VS2017 Professional 15.2版(26430.16)。
这是答案:
#if
块的语法高亮。 TargetFrameworks
声明的所有项目,即使文本在编辑器中显示为灰色。 总而言之,这只是我的学习曲线。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.