Skip to content
Latchkey

NuGet "error NU1202: Package is not compatible with framework" in CI

The package exists and a version was selected, but it ships no assets compatible with your project's target framework. NU1202 lists which frameworks the package does support so you can see the mismatch.

What this error means

dotnet restore fails with "error NU1202: Package X 1.0.0 is not compatible with net8.0. Package X supports: netstandard2.0, net48".

dotnet
error NU1202: Package Legacy.Lib 1.0.0 is not compatible with net8.0 (.NETCoreApp,Version=v8.0).
Package Legacy.Lib 1.0.0 supports: net48 (.NETFramework,Version=v4.8)

Common causes

The package targets only frameworks you do not use

A net48-only package cannot be consumed by a net8.0 project, so restore reports it as incompatible.

A wrong TFM after a project upgrade

You moved the project to a newer framework but a dependency has not shipped support for it yet.

How to fix it

Pick a package version that supports your TFM

  1. Read the "supports:" line to see the package's frameworks.
  2. Upgrade to a package version that supports your target, or choose an alternative.
  3. Re-run restore to confirm compatibility.
Project.csproj
<PackageReference Include="Legacy.Lib" Version="2.0.0" />

Multi-target if you must keep the old package

Add a framework the package supports so a compatible asset exists for at least one TFM.

Project.csproj
<TargetFrameworks>net8.0;net48</TargetFrameworks>

How to prevent it

  • Check package framework support before bumping a project TFM.
  • Prefer dependencies that ship netstandard2.0 or current targets.
  • Multi-target only when a dependency forces it.

Frequently asked questions

What causes ""error NU1202: ... not compatible with""?
A net48-only package cannot be consumed by a net8.0 project, so restore reports it as incompatible.
How do I fix "error NU1202: ... not compatible with"?
Pick a package version that supports your TFM

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card