Optimizes .NET projects for multiple target frameworks using polyfills, conditional compilation, and API compatibility validation.
This skill provides a comprehensive framework for managing .NET libraries and applications that must support multiple Target Framework Monikers (TFMs). It advocates for a 'polyfill-first' approach, leveraging tools like PolySharp and SimonCropp/Polyfill to enable modern C# language features and BCL APIs on older runtimes without code clutter. By providing a structured decision matrix, it helps developers choose between polyfills, conditional compilation, or the adapter pattern, ensuring codebases remain maintainable while supporting both legacy frameworks and the latest .NET versions.
主要功能
01PolySharp integration for compiler-synthesized language feature stubs
02TFM-specific source file management and API compatibility validation
03SimonCropp/Polyfill guidance for backporting BCL API implementations
04Decision matrix for selecting polyfills vs. conditional compilation
050 GitHub stars
06Advanced .csproj patterns for multi-TFM project configuration
使用场景
01Backporting modern C# features like 'required' members and 'init' properties to legacy targets.
02Developing NuGet libraries that support .NET Standard 2.0 and modern .NET versions simultaneously.
03Implementing performance-optimized code paths for newer runtimes using preprocessor symbols.