Skip to content
Latchkey

NuGet "NU1202: package is not compatible" - TFM Mismatch in CI

NuGet found the package but none of its assets support your project’s target framework moniker (TFM). It reports NU1202 listing the frameworks the package does support.

What this error means

Restore fails with NU1202 saying the package is not compatible with your TargetFramework, then lists the frameworks it does support. It is deterministic and tied to the project’s TFM.

dotnet restore output
error NU1202: Package LegacyLib 1.0.0 is not compatible with net8.0 (.NETCoreApp,Version=v8.0).
Package LegacyLib 1.0.0 supports: net472 (.NETFramework,Version=v4.7.2)

Common causes

Package targets a framework your project does not

A package built only for .NET Framework (net472) cannot be referenced by a net8.0 project unless a compatible asset exists.

Requested version predates support for your TFM

An older version of the package may not support your target; a newer version often adds it.

How to fix it

Upgrade to a version that supports your TFM

Check for a newer release that targets your framework and pin it.

Terminal
dotnet package search LegacyLib
# pin a version with a net8.0-compatible asset
# <PackageReference Include="LegacyLib" Version="3.0.0" />

Retarget the project or find an alternative

  1. If the package only ever targets net472, retarget the project (or multi-target) if feasible.
  2. Otherwise replace the package with a maintained, compatible alternative.
  3. For mixed solutions, keep Framework-only consumers on a Framework TFM.

How to prevent it

  • Check a package’s supported TFMs before adding it to a modern project.
  • Prefer packages that target netstandard2.0+ for broad compatibility.
  • Keep dependencies current so they support your project’s framework.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →