lamboktulus1379
lamboktulus1379

Reputation: 370

.NET Core Web API 5.0 build errors

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!

Upvotes: 6

Views: 14685

Answers (4)

KnuturO
KnuturO

Reputation: 1635

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

Upvotes: 15

i31nGo
i31nGo

Reputation: 1502

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

Upvotes: 8

Manfred Wippel
Manfred Wippel

Reputation: 2076

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

Upvotes: 12

Panagiotis Kanavos
Panagiotis Kanavos

Reputation: 131512

You're using an extremely old .NET 5 preview. ASP.NET Core Preview 1 specifically had no new features, it was essentially a version number change. There's no netcoreapp5.0 framework target any more, it's net5.0.

The latest version is 5.0 RC1 which is feature-complete and supported in production. Install it and create a new project with, eg dotnet new webapp or dotnet new webapi etc.

This version is supported by the latest Visual Studio 2019 Preview version.

Upvotes: 1

Related Questions