.NET Core Web API 5.0 build errors

Viewed 12295

Severity Code Description Project File Line Suppression State Error NETSDK1005 Assets file 'D:\Working On\Gra\Gra\obj\project.assets.json' doesn't have a target for '.NETCoreApp,Version=v5.0'. Ensure that restore has run and that you have included 'netcoreapp5.0' in the TargetFrameworks for your project. Gra C:\Program Files\dotnet\sdk\5.0.100-preview.1.20155.7\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 234

I've just create ASP.NET Core Web Application, and then when I run, I it's show message errors!

4 Answers

In my publish profile the Target Framework was set to NET5.0. Changed it to NET6.0 and the problem was gone.

Update to Nuget 5.8 Clear the local cache

error NETSDK1005: Assets file 'project.assets.json' ....

Try updating NuGet.exe to the 5.8.0 version or above:

nuget update -self

if you prefer to update the nuget version in Visual Studio, just follow this steps. Then, clear NuGet cache:

dotnet nuget locals all --clear

Download Nuget

found here

Delete the 'obj' folder and re-build the project.

Related