dotnet-multi-targeting

Configure .NET multi-targeting with PolySharp and Polyfill for older TFMs.

10|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/AGIBuild/Agibuild.Fulora --skill dotnet-multi-targeting
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dotnet-multi-targeting
Source: https://github.com/AGIBuild/Agibuild.Fulora/tree/main/.cursor/skills/dotnet-multi-targeting
Command: npx skills add https://github.com/AGIBuild/Agibuild.Fulora --skill dotnet-multi-targeting

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

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.

Frequently Asked Questions about dotnet-multi-targeting

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use C# 14 features like required modifiers on older .NET target frameworks?▼

You can use C# 14 features like `required` modifiers on older .NET target frameworks by applying polyfill strategies with PolySharp and SimonCropp/Polyfill. These tools backport language features and BCL APIs to ensure cross-framework compatibility.

What is the best way to configure a .csproj file for multi-targeting multiple TFMs?▼

Configuring a .csproj for multi-targeting involves specifying multiple Target Framework Monikers and setting up conditional package references. This approach ensures your library builds correctly across diverse .NET environments using TFM-specific source files.

How do I validate API compatibility across different .NET framework versions?▼

To validate API compatibility across different .NET framework versions, use the `EnablePackageValidation` property and the `ApiCompat` tool. These mechanisms ensure API consistency across all targeted TFMs during the build process.

When do I need conditional compilation with #if directives in .NET multi-targeting?▼

You need conditional compilation with `#if` directives in .NET multi-targeting to handle runtime behavior differences and platform-specific APIs. This approach allows your code to execute framework-specific logic based on the target TFM.

Does PolySharp work with .NET 8.0 and .NET 10.0 target frameworks?▼

Yes, PolySharp works with .NET 8.0 and .NET 10.0 target frameworks. It enables you to use newer C# language features on older TFMs by providing the necessary polyfills for cross-framework development compatibility.

What are the limitations of using polyfills for multi-targeting in .NET libraries?▼

The limitations of using polyfills for multi-targeting in .NET libraries include the need to manually manage conditional compilation and validate API consistency using `EnablePackageValidation`. Polyfills only backport language features and BCL APIs, not underlying runtime platform capabilities.