I have a multi-targeted solution which fails to rebuild consistently and keeps reporting the error
Error NETSDK1005 Assets file ‘ …\obj\project.assets.json’ doesn’t
have a target for ‘net4.8’. Ensure that restore has run and
that you have included ‘net4.8’ in the TargetFrameworks for your
project.
Occasionally a second rebuild will work, but not always.
Building the projects individually always works but that is tedious.
An absolutely minimal project which contains two projects also exhibits the same problem.
Project1
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
</PropertyGroup>
</Project>
Project2
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net4.8</TargetFrameworks>
</PropertyGroup>
</Project>
(And yes, apart from the solution, that’s it – no code and no nuget packages involved in the test solution)
Using VS 2022 Version 17.9.6
Has anyone any ideas?