I have a class library that targets multiple frameworks.
i.e.
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
When msbuild builds my application it correctly spits out both netstandard2.0 and netstandard2.1 assemblies. I'm using precompile directives to include framework-specific code in the solution:
#if NETSTANDARD2_1
Visual Studio seems to choose to define NETSTANDARD2_0
, but I can't figure out how to force it to use NETSTANDARD2_1
instead. The code within the NETSTANDARD2_1
precompile directive is always grayed out.