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
- If the package only ever targets
net472, retarget the project (or multi-target) if feasible. - Otherwise replace the package with a maintained, compatible alternative.
- 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
NuGet "NU1101: Unable to find package" - Fix in CIFix NuGet error NU1101 "Unable to find package <id>. No packages exist with this id in source(s)" during dotn…
dotnet SDK / Runtime Mismatch - TargetFramework Not SupportedFix .NET SDK and TargetFramework mismatches in CI - "NETSDK1045: The current .NET SDK does not support target…
MSBuild "MSB3644: reference assemblies were not found"Fix MSBuild "MSB3644: The reference assemblies for .NETFramework,Version=vX were not found" in CI - install t…