I have a multi-platform solution with many csproj
files configured this way:
<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>
Note that I don't have a TargetFramework
element (the singular form). I only have the TargetFrameworks
element (the plural form).
The editor assumes netstandard1.4
and all #if NET452
blocks get grayed out and without IntelliSense.
How can I tell Visual Studio editor to recognize a specific target framework ( net452
, netstandard1.4
), and get IntelliSense, at least temporarily?
For reference, I'm using VS2017 Professional version 15.2 (26430.16).
Here's the answer:
#if
blocks according to the selected framework. TargetFrameworks
, even if the text is grayed at editor. All in all, it was just my learning curve.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.