Error Knowledge Base NuGet NU1202

NU1202: Package is not compatible with the target framework

The selected package version does not contain lib or ref assets compatible with one of your project’s target frameworks or platforms.

What Broke in the Dependency Graph

The selected package version does not contain lib or ref assets compatible with one of your project’s target frameworks or platforms.

Repair the dependency graph

Choose a package version that supports your TFM by upgrading the package or its parents.

If multi-targeting, conditionally reference packages per TFM or adjust TargetFrameworks.

Re-run restore:dotnet restore

Validation

Re-run the failing command and confirm the original code/message is gone, and confirm expected artifacts or outputs exist (packages restored, build/publish succeeds).

Why Resolution Broke

Usually this comes down to the selected package version doesn’t support your TFM or platform TFM, one TFM in TargetFrameworks is unsupported even if others work, or a transitive dependency forces an older package version without your TFM.

Prove the Graph Is Clean Again

dotnet restore succeeds across all TFMs, and dotnet build or dotnet test succeeds for the previously failing TFM.

Typical Output

error NU1202: Package Some.Package 1.2.3 is not compatible with net8.0.

Mechanism

NuGet selects a package version, then picks the best lib or ref assets for each TargetFramework. If no compatible assets exist for a TFM, restore fails with NU1202.

Keep the Dependency Graph Healthy

To prevent this, upgrade dependencies alongside runtime and TFM upgrades, and continuously validate multi-target builds in CI.

Docs and source code

NU1202 compatibility failure message

Message template for incompatible TFM assets. - GitHub

  <data name="Log_PackageNotCompatibleWithFx" xml:space="preserve">
    <value>Package {0} {1} is not compatible with {2}.</value>
    <comment>0 - package id, 1 - version, 2 - target framework</comment>
  </data>
  <data name="Log_PackagesAndProjectsAreCompatible" xml:space="preserve">

Need help or found a mistake? Contact RepoFlow support for questions.

Join our mailing list