Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I got this error
Your project does not reference ".NETFramework,Version=v4.6.1" framework. Add a reference to ".NETFramework,Version=v4.6.1" in the "TargetFrameworks" property of your project file and then re-run NuGet restore.
after checkout a project from company repository and rebuild on my machine.
When I try to install .Net461 (downloaded from
here
) they said
.NET Framework 4.6.1 or a later update is already installed on this computer.
This is all .NET framework versions on my machine (Windows 10 1703)
PS C:\Users\longnx\Downloads> & '.\check-dotnet-framework-version (1).ps1'
PSChildName Version Release
----------- ------- -------
v2.0.50727 2.0.50727.4927
v3.0 3.0.30729.4926
Windows Communication Foundation 3.0.4506.4926
Windows Presentation Foundation 3.0.6920.4902
v3.5 3.5.30729.4926
Client 4.7.03062 461814
Full 4.7.03062 461814
Client 4.0.0.0
PS C:\Users\longnx\Downloads>
How can I fix this error?
update on 2020-05-26:
for anyone face this problem, I don't suggest this but from my experience, I've uninstalled and reinstall visual studio, and problem gone.
–
–
–
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.
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
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.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.