Microsoft .net Framework 4 Multi Targeting Pack
#if NET40 // Work around a bug in .NET 4.0's ConcurrentDictionary UseLegacyFallback(); #else UseModernAPI(); #endif
Multi-targeting is a feature of the .NET Framework that allows developers to target multiple versions of the framework from a single project. This means that a developer can create a project that targets .NET Framework 4, but also includes references to assemblies that are compatible with .NET Framework 3.5 or 2.0. This allows developers to take advantage of the new features and improvements in the latest version of the framework, while still supporting older versions. microsoft .net framework 4 multi targeting pack
Use a dedicated build agent with the targeting packs for the versions you support. Never assume a build agent with .NET 4.8 can accurately compile a .NET 4.0 app without the pack—it cannot. The compiler will assume newer APIs exist if reference assemblies are missing. #if NET40 // Work around a bug in