And yes, I have tried all similar QAs and nothing helped.
What I have tried, none helped:
What I know:
WTF? How is this possible? What else can i clean?
Full log:
Rebuild started...
1>------ Rebuild All started: Project: DotNetExtensions, Configuration: Release Any CPU ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\NuGet\16.0\Microsoft.NuGet.targets(198,5): error : Your project does not reference ".NETFramework,Version=v4.7.1" framework. Add a reference to ".NETFramework,Version=v4.7.1" in the "TargetFrameworks" property of your project file and then re-run NuGet restore.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
I tried to port my projects to .net 5.0 and encountered this problem when reverting back to 4.8. This worked for me:
I had a very similar error except it was:
Your project does not reference ".NETFramework,Version=v4.8" framework. Add a reference to ".NETFramework,Version=v4.8" in the "TargetFrameworks" property of your project file and then re-run NuGet restore.
What worked for me was to use Visual Studio to 1) clean the solution and then 2) delete all obj and bin folders. Then it built without restarting VS.
I think it was a bad cache of the project.assets.json file. It must have gotten corrupt when restoring a stash that required a merge. VS didn't automatically load the projects. It isn't related to the TargetFrameworks because when you add that property to the csproj file, a different build step fails.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With