How to Fix ‘Your Project Does Not Reference .NETFramework Version=v4.7.2’ When It Does

After updating some NuGet packages, one of our .net 4.7.2 projects throw this error when we try to build it:

Error: Your project does not reference “.NETFramework,Version=v4.7.2” framework. Add a reference to “.NETFramework,Version=v4.7.2” in the “TargetFrameworks” property of your project file and then re-run NuGet restore.

Should you get the same error, you can do these steps to fix the problem:

  1. Open the folder that contains the *.csproj file of the project that does not build
  2. Delete the folders bin and obj
  3. Rebuild your solution

The removal of the bin and obj folder did the trick for us. If it does not work right out of the box, restart Visual Studio and do a “Clean Solution” in the Solution Explorer view.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.