NuGet "NU1202: package is not compatible with framework" in CI
The package was found and the version resolved, but it ships no build assets for your target framework. NU1202 lists the frameworks the package does support, which tells you whether to change your TFM or pick a different package version.
What this error means
Restore fails with NU1202 naming the package, your TFM, and the "supports:" list of frameworks the package actually targets. Deterministic for a given package version and project TFM.
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 only targets a framework you are not building
A package that ships only net48 assets cannot be consumed by a net8.0 project - there is no compatible asset to restore.
A newer package version dropped support for your TFM
An upgrade moved the package to a higher minimum framework than your project targets.
How to fix it
Use a package version that supports your TFM
- Check the package's supported frameworks on the feed.
- Pin a version whose assets cover your target framework.
- Re-run restore.
<PackageReference Include="Legacy.Lib" Version="2.0.0" />Multi-target or change your TFM
- If the package only supports an older framework, multi-target the project (e.g.
net48;net8.0). - Or change the project's
TargetFrameworkto one the package supports. - Restore and build.
<PropertyGroup>
<TargetFrameworks>net48;net8.0</TargetFrameworks>
</PropertyGroup>How to prevent it
- Confirm a package targets your TFM before adding or upgrading it.
- Watch release notes for minimum-framework bumps on upgrades.
- Multi-target libraries that must support both old and new frameworks.