Guides developers through complex .NET multi-targeting scenarios using a polyfill-first approach to maximize code compatibility and modern syntax usage.
The dotnet-multi-targeting skill provides a comprehensive framework for managing multiple Target Framework Monikers (TFMs) within .NET applications. It advocates for a 'polyfill-first' strategy, utilizing tools like PolySharp and SimonCropp/Polyfill to backport modern C# language features and BCL APIs to older runtimes without adding runtime dependencies. By providing a clear decision matrix, it helps developers choose between polyfills, conditional compilation, and adapter patterns, ensuring that cross-platform libraries and legacy migrations remain maintainable and performant.
Key Features
01Implementation patterns for SimonCropp/Polyfill for BCL API backporting
02Polyfill-first strategy for backporting modern C# features to older TFMs
030 GitHub stars
04Guidance on using PolySharp for compiler-synthesized attribute stubs
05Decision matrix for choosing between PolySharp, BCL polyfills, and #if blocks
06Structured TFM-based preprocessor symbol management and API validation
Use Cases
01Using modern C# 11+ features like 'required' members on older .NET Standard 2.0 targets
02Validating API compatibility across multiple target frameworks during library development
03Developing NuGet packages that need to support both legacy .NET Framework and modern .NET