I have an MVC solution that I'm trying to build with Visual Studio 2015 and I'm getting the following error:
Your project is not referencing the ".NETFramework,Version=v4.5.2" framework. Add a reference to ".NETFramework,Version=v4.5.2" in the "frameworks" section of your project.json, and then re-run NuGet restore.
The same solution on my coworker box with the same version of Visual Studio compiles fine.
Version Used:
Visual Studio 2015 Update 3 version 14.0.25431.01
.NET Framework 4.6.01586
Windows 10
I am attaching the error log as suggested by the article referencing the IDE0006
error as I don't understand what's going on.
https://gist.github.com/tanis2000/a89dc9ae8f1400e734cf6eab8af193d0
Here's the csproj file as well just in case:
https://gist.github.com/tanis2000/302c2197a01df3199075b74ecbed7ae1
It turns out I had a file called project.json.lock
in that folder for an unknown reason. I deleted it and now it builds fine.
I'm going to mark this as a bug, since the error you saw reported did not lead you to a resolution.
It sounds fine. If there's no project.json
but there is a project.json.lock
and a .csproj
it should point out that there is a stale lock file but no project in that format. It should tell the user to check the project folder and eventually delete the lock file if this isn't a project.json
-based project.
Cheers!
@srivatsn @rrelyea it sounds like either project-system
or NuGet
is a better home for this?
For me it was project.assets.json
in the obj
folder.
The same thing happened to me in a non-SDK style project of type library of classic .Net and just cleaning sources before the build resolved the problem of having some file lying around that must have caused this issue.
This is happening to me after opening and working on a solution in Visual Studio for Mac and then trying to build the same solution in VS2017 on windows 7.
Error
Your project is not referencing the ".NETFramework,Version=v4.0" framework. Add a reference to ".NETFramework,Version=v4.0" in the "frameworks" section of your project.json, and then re-run NuGet restore.
There is no project.json in this particular folder, but there are three different csproj
files for the same code.
I can resolve this issue by deleting the bin
and obj
folders.
Same problem VS2019 (16.4.4) migrating nuget packages from packages.config to PackageReference and switching git branches back and forth.
Deleting obj folder helps.
Most helpful comment
For me it was
project.assets.json
in theobj
folder.