© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
12 replies
Gaweringo

`dotnet build` errors NU1202 but building in IDE works

I have
Npgsql.EntityFrameworkCore.PostgreSQL
Npgsql.EntityFrameworkCore.PostgreSQL
as my package for EF and I tried to run
dotnet ef migrations add
dotnet ef migrations add
to create a new migration but it returns with
Build failed. Use dotnet build to see the errors.
Build failed. Use dotnet build to see the errors.
.
When I then run
dotnet build
dotnet build
I get this error:
❯ dotnet build                     
MSBuild version 17.7.3+8ec440e68 for .NET
  Determining projects to restore...
C:\...Web.csproj : error NU1202: Package Microsoft.EntityFrameworkCore.Tools 7.0.13 is not compatible with net70 (.NETFramework,Version=v7.0). 
Package Microsoft.EntityFrameworkCore.Tools 7.0.13 supports: net6.0 (.NETCoreApp,Version=v6.0)
C:\...Web.csproj : error NU1202: Package Npgsql.EntityFrameworkCore.PostgreSQL 7.0.11 is not compatible with net70 (.NETFramework,Version=v7.0). Package Npgsql.EntityFrameworkCore.PostgreSQL 7.0.11 supports:
C:\...Web.csproj : error NU1202:   - net6.0 (.NETCoreApp,Version=v6.0)
C:\...Web.csproj : error NU1202:   - net7.0 (.NETCoreApp,Version=v7.0)
C:\...Web.csproj : error NU1202: Package Microsoft.EntityFrameworkCore.Tools 7.0.13 is not compatible with net70 (.NETFramework, Version=v7.0) / win7-x86. Package Microsoft.EntityFrameworkCore.Tools 7.0.13 supports: net6.0 (.NETCoreApp,Version=v6.0)
C:\...Web.csproj : error NU1202: Package Npgsql.EntityFrameworkCore.PostgreSQL 7.0.11 is not compatible with net70 (.NETFramework,Version=v7.0) / win7-x86. Package Npgsql.EntityFrameworkCore.PostgreSQL 7.0.11 supports:
C:\...Web.csproj : error NU1202:   - net6.0 (.NETCoreApp,Version=v6.0)
C:\...Web.csproj : error NU1202:   - net7.0 (.NETCoreApp,Version=v7.0)
  Failed to restore C:\...Web.csproj (in 157 ms).

Build FAILED.
❯ dotnet build                     
MSBuild version 17.7.3+8ec440e68 for .NET
  Determining projects to restore...
C:\...Web.csproj : error NU1202: Package Microsoft.EntityFrameworkCore.Tools 7.0.13 is not compatible with net70 (.NETFramework,Version=v7.0). 
Package Microsoft.EntityFrameworkCore.Tools 7.0.13 supports: net6.0 (.NETCoreApp,Version=v6.0)
C:\...Web.csproj : error NU1202: Package Npgsql.EntityFrameworkCore.PostgreSQL 7.0.11 is not compatible with net70 (.NETFramework,Version=v7.0). Package Npgsql.EntityFrameworkCore.PostgreSQL 7.0.11 supports:
C:\...Web.csproj : error NU1202:   - net6.0 (.NETCoreApp,Version=v6.0)
C:\...Web.csproj : error NU1202:   - net7.0 (.NETCoreApp,Version=v7.0)
C:\...Web.csproj : error NU1202: Package Microsoft.EntityFrameworkCore.Tools 7.0.13 is not compatible with net70 (.NETFramework, Version=v7.0) / win7-x86. Package Microsoft.EntityFrameworkCore.Tools 7.0.13 supports: net6.0 (.NETCoreApp,Version=v6.0)
C:\...Web.csproj : error NU1202: Package Npgsql.EntityFrameworkCore.PostgreSQL 7.0.11 is not compatible with net70 (.NETFramework,Version=v7.0) / win7-x86. Package Npgsql.EntityFrameworkCore.PostgreSQL 7.0.11 supports:
C:\...Web.csproj : error NU1202:   - net6.0 (.NETCoreApp,Version=v6.0)
C:\...Web.csproj : error NU1202:   - net7.0 (.NETCoreApp,Version=v7.0)
  Failed to restore C:\...Web.csproj (in 157 ms).

Build FAILED.

But when I use the build or run functions in Rider or Visual Studio it builds and runs fine. (Rider also shows errors after running
dotnet build
dotnet build
which go away after building with rider itself)

What I tried:
TargetFramework
TargetFramework
in my
.csproj
.csproj
is set to
net7.0
net7.0
. I tried
net6.0
net6.0
and I got the same error but with
net60
net60
.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

❔ dotnet build
C#CC# / help
4y ago
❔ ✅ Schrödinger's errors (errors in build but not compile)
C#CC# / help
3y ago
✅ InitializeComponent not being found, but `dotnet run` works?
C#CC# / help
3y ago
Build order with dotnet build ...?
C#CC# / help
2y ago