With project.json
, it was possible to target different target frameworks, specifying different dependencies and conditional compilation symbols for each target framework.
I need to do the same thing with a .NET Standard class library using the .csproj
project format. I know how to target multiple frameworks, but how do you specify different dependencies and conditional compilation symbols for each?
(In case "conditional compilation" is not clear, I need the ability to specify preprocessor directives in code such as #if NET452
.)
A good example where this is useful is when dealing with appsettings. With the full .NET Framework, you need to reference System.Configuration.dll
and work through ConfigurationManager
. .NET Core configuration is a totally different beast.