Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Error NU1202 Package is not compatible framework, when it actually is

$
0
0

NU1202 Package errors

I have two custom nuget packages (PackageABC and PackageXYZ), both support multi-targeting. Using this:

<TargetFrameworks>net6.0;net7.0;net8.0;</TargetFrameworks>

PackageXYZ makes use of PackageABC as a PackageReference.

Recently I started getting "Error NU1202 Package PackageABC 1.0.5 is not compatible netX.X", I am not receiving any errors about package downgrades, or any other nuget errors. Just this one.

This is the project xml for ProjectABC:

<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><TargetFrameworks>net6.0;net7.0;net8.0;</TargetFrameworks><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable><GeneratePackageOnBuild>True</GeneratePackageOnBuild><Version>1.0.5</Version></PropertyGroup><ItemGroup><PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.4" /><PackageReference Include="Npgsql" Version="8.0.1" /></ItemGroup><ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' Or '$(TargetFramework)' == 'net7.0'"><PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" /><PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.15" /><PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.15" /><PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.11" /></ItemGroup><ItemGroup Condition=" '$(TargetFramework)' == 'net8.0'"><PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" /><PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" /><PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" /><PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" /></ItemGroup></Project>

The errors I am receiving when compiling PackageXYZ:

  • Error NU1202 Package PackageABC 1.0.5 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package PackageABC 1.0.5 supports:

    • net6.0 (.NETCoreApp,Version=v6.0)
    • net7.0 (.NETCoreApp,Version=v7.0)
    • net8.0 (.NETCoreApp,Version=v8.0)
  • Error NU1202 Package PackageABC 1.0.5 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package PackageABC 1.0.5 supports:

    • net6.0 (.NETCoreApp,Version=v6.0)
    • net7.0 (.NETCoreApp,Version=v7.0)
    • net8.0 (.NETCoreApp,Version=v8.0)
  • Error NU1202 Package PackageABC 1.0.5 is not compatible with net8.0 (.NETCoreApp,Version=v8.0). Package PackageABC 1.0.5 supports:

    • net6.0 (.NETCoreApp,Version=v6.0)
    • net7.0 (.NETCoreApp,Version=v7.0)
    • net8.0 (.NETCoreApp,Version=v8.0)

The question:

What is causing the compiler to say that it does not support a framework, when it clearly does? Is there any way I can figure out what is causing this? The errors are very confusing to me, as in one part it says it does not support the framework, then in the next part of the error states that it does support the framework.

Here is a screenshot of the errors I am receiving:compile errors

The first three errors are because PackageXYZ fails to compile


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>