user7242966
user7242966

Reputation: 347

vs compiler complaining about missing reference in project.json but .net proj is not core

I have an MVC app which targets .NET f/w 4.5.2. I was copying over some files from a .NET core app on a previous branch. I installed a few npm packages on the previous branch. Now on my new clean branch which I just created from develop, VS is returning the following error:

Severity Code Description Project File Line Suppression State 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. MyCompany.Website

I think project.json is a file specific to the .NET Core f/w so the compiler shouldn't be requiring a project.json update in a 4.5.2 app. What do I need to do to get around this error message? I tried "git clean -f" on this directory but the error still occurs. Any idea how to fix this?

Upvotes: 4

Views: 2677

Answers (2)

Martin Prikryl
Martin Prikryl

Reputation: 202242

It's kind of a bug in Visual Studio.

See https://github.com/dotnet/roslyn/issues/20628

A solution is to look for obsolete project.lock.json and/or project.assets.json files and delete them.

Upvotes: 4

user7242966
user7242966

Reputation: 347

I found the answer in another thread. Look for a project.lock.json file then delete it. Issue fixed.

Upvotes: 0

Related Questions