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".
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
- Read the "supports:" line to see the package's frameworks.
- Upgrade to a package version that supports your target, or choose an alternative.
- Re-run restore to confirm compatibility.
<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.
<TargetFrameworks>net8.0;net48</TargetFrameworks>How to prevent it
- Check package framework support before bumping a project TFM.
- Prefer dependencies that ship
netstandard2.0or current targets. - Multi-target only when a dependency forces it.