This is happening after updating Visual Studio to version 16.8 and only with a CLI build (MSBuild.exe) and local NuGet.exe

If you are getting the following errors:

C:\Program Files\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5): error NETSDK1005: Assets file 'project.assets.json' doesn't have a target for 'net48'. Ensure that restore has run and that you have included 'net48' in the TargetFrameworks for your project.

Try updating NuGet.exe to the 5.8.0 version or above

and clearing NuGet cache:

dotnet nuget locals all --clear

Download NuGet.exe 5.8.0