What problem does it solve?
This Skill provides comprehensive guidance on targeting multiple .NET Target Framework Monikers (TFMs) and using newer C# language features with older TFMs, ensuring your libraries and applications remain compatible across diverse .NET environments.
Core Features & Use Cases
- Polyfill Strategies: Leverages PolySharp and SimonCropp/Polyfill for backporting language features and BCL APIs.
- Conditional Compilation: Guides on using
#if directives for runtime behavior differences and platform-specific APIs.
- Project Configuration: Demonstrates best practices for
.csproj multi-targeting, conditional package references, and TFM-specific source files.
- API Validation: Explains how to use
EnablePackageValidation and the ApiCompat tool to ensure API consistency across TFMs.
- Use Case: You are developing a .NET library that needs to support .NET 8.0 and .NET 10.0. This Skill helps you use C# 14 features like
required modifiers and init properties on .NET 10.0 by providing the necessary polyfills and project configurations.
Quick Start
Use the dotnet-multi-targeting skill to configure your .NET project to support both net8.0 and net10.0 TFMs using PolySharp and Polyfill.