Scaffolding works perfect from VS, only the CLI fails
dotnet tool uninstall --global dotnet-ef
Tool 'dotnet-ef' (version '3.1.7') was successfully uninstalled.
dotnet tool install --global dotnet-ef --version 5.0.0-*
dotnet new webapp -o ContosoUniversity
cd ContosoUniversity
Add the following Student model:
public class Student
{
public int ID { get; set; }
public string LastName { get; set; }
public string FirstMidName { get; set; }
}
Run the following .NET Core CLI commands to install required NuGet packages:
dotnet tool install --global dotnet-aspnet-codegenerator --version 5.0.0-*
dotnet add package Microsoft.EntityFrameworkCore.SQLite -v 5.0.0-*
dotnet add package Microsoft.EntityFrameworkCore.SqlServer -v 5.0.0-*
dotnet add package Microsoft.EntityFrameworkCore.Design -v 5.0.0-*
dotnet add package Microsoft.EntityFrameworkCore.Tools -v 5.0.0-*
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design -v 5.0.0-*
dotnet add package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore -v 5.0.0-*
Scaffold command
dotnet aspnet-codegenerator razorpage -m Student -dc ContosoUniversity.Data.SchoolContext -udl -outDir Pages\Students --referenceScriptLibraries
Scaffold Student
error NETSDK1005: Assets file 'c:\tmp\x\ContosoUniversity\obj\project.assets.json' doesn't have a target for 'net50'. Ensure that restore has run and that you have included 'net50' in the TargetFrameworks for your project. [c:\tmp\x\ContosoUniversity\ContosoUniversity.csproj]
Build FAILED.
C:\Program Files\dotnet\sdk\5.0.100-rc.1.20452.10\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5): error NETSDK1005: Assets file 'c:\tmp\x\ContosoUniversity\obj\project.assets.json' doesn't have a target for 'net50'. Ensure that restore has run and that you have included 'net50' in the TargetFrameworks for your project. [c:\tmp\x\ContosoUniversity\ContosoUniversity.csproj]
0 Warning(s)
1 Error(s)
Windows 10, fully patched
5.0.100-rc.1.20452.10
Facing same issue
Ubuntu 18.04
Hi @en1tan
I had the same issue.
I updated dotnet-aspnet-codegenerator and it worked fine.

Most helpful comment
Hi @en1tan
I had the same issue.
I updated
dotnet-aspnet-codegeneratorand it worked fine.please check document