0Pricing
C# Academy · Lesson

Multi-targeting

Build one library for multiple target frameworks from a single project; use conditional compilation and fallback shims for API differences.

Concept & benefits

Goal: Ship one package that works on multiple platforms.

  • Single project produces multiple binaries
  • Consumers get the best-fit assembly automatically
  • Use small #if guards when APIs differ

Asset selection basics

  • Package contains folders per target (e.g., lib/net45, lib/netstandard2.0)
  • NuGet picks the nearest compatible asset
  • Keep public API consistent; only internal code should differ

All lessons in this course

  1. Library vs app .csproj, semantic versioning
  2. Packing & publishing to NuGet
  3. Multi-targeting
← Back to C# Academy