`dotnet build` errors NU1202 but building in IDE works
I have
Npgsql.EntityFrameworkCore.PostgreSQL
as my package for EF and I tried to run dotnet ef migrations add
to create a new migration but it returns with Build failed. Use dotnet build to see the errors.
.
When I then run dotnet build
I get this error:
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
which go away after building with rider itself)
What I tried:
TargetFramework
in my .csproj
is set to net7.0
. I tried net6.0
and I got the same error but with net60
.9 Replies
Show your csproj?
I'm comparing it with my project's
.csproj
and everything seems to be in order. Except I use 7.0.4
version of NpgSQL and 7.0.10
of the EF tools
But I don't thing it should change muchYeah I tried downgrading NpgSql to
7.0.4
but still the same.
I also tried creating a new ASP.NET Core with Angular
project in VS and tried running dotnet build without doint anything else and I get this error:
Which says something about .NETFramework
which is also in the other error message and confuses me somewhat with .NET Framework
being the old pre .NET Core
thing.
Especially because the first error message is posted has this:
not compatible with net70 (.NETFramework,Version=v7.0)
.... supports: C:\...Web.csproj : error NU1202: - net6.0 (.NETCoreApp,Version=v6.0)
Huh...
Out of curiosity, what does
dotnet --list-sdks
show?Yeah, I'm out of ideas
I finally got it!
I had a dotnet 3.0.3 Runtime installed and also the
dotnet3-sdk
via scoop (for some old thing I tried to build, that I can't even remember right now).
I uninstalled that and now it works.
I found it as it was in some paths that This SO Answer talked about.
Anyways, thanks a lot for your help and time :)Seems like it was a very specific and very odd issue lol
Glad you got it sorted somehow