c# - How to fix `Your project does not reference ".NETFramework,Version=v4.6.1" framework...`

ID : 131318

viewed : 10

Tags : c#.netmsbuildnugetnuget-package-restorec#

Top 4 Answer for c# - How to fix `Your project does not reference ".NETFramework,Version=v4.6.1" framework...`

vote vote


I found this link from a google search and tried it and it fixed my issue so I thought I might share that deleting the obj folders seems to work.

As it states in forum:

I had the same with an old project (after using git to move to an old version locally). Deleting the 'obj' folders fixed the issue, clean is insufficient.

Two users found that this fix the issue. Most also found doing a clean and then removing the obj folder by hand then redoing a nuget restore seemed to fix the issue.

vote vote


The error can be solved by deleting the obj folder. But, if you have more than one project in the solution, targeting and deleting all the obj folders can be burdensome. So you can run this PowerShell command in the root of your code repository (or in the solution folder) to recursively find and delete obj folders and their content.

Get-ChildItem -Filter obj -Recurse -Force | Remove-Item -Recurse -Force 
vote vote


Most of the time when I face this error I just Delete or Rename the OBJ folder and try to run Visual Studio as Administrator (don't make much of difference, but helps when I download project from some tutorial website) and build the Application again.

But if that don't work then check of version of NuGet package compatibility with .net version in project setting/properties page, having to get proper NuGet package and .net version is a must for building and program. Also removing and reinstalling Visual Studio and installing that again is never an option, as it takes time to uninstall and install again.

vote vote


Top 3 video Explaining c# - How to fix `Your project does not reference ".NETFramework,Version=v4.6.1" framework...`