change a .net 4.6.1 project to .net 4.7 failed

Delete /bin and /obj and rebuild your solution.


Faced the same issue when building the solution which was accidentally created in .NetStandard.

When we changed the project file everything was working fine on one developer machine but the others were facing the exactly same issue.

"Your project is not referencing the ".NETFramework,Version=v4.7" framework. Add a reference to ".NETFramework,Version=v4.7" in the "frameworks" section of your project.json, and then re-run NuGet restore."

To fix this:

  • Clean the solution
  • See if there is anything left in the /bin /obj folder if there then delete them.
  • Rebuild the solution

In our case the obj and the bin files were not cleared by the Clean action.

Hope this helps.


You should delete your obj folder.

Please refer to:

https://developercommunity.visualstudio.com/content/problem/10334/your-project-is-not-referencing-the-netframeworkve.html

Tags:

.Net