Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing .Net reference compile error with NuGet "TargetFramework" ... how to fix?

I had not seen this before, but when opening a project that worked fine on a coworkers machine I saw this...

error : Your project does not reference ".NETFramework,Version=v4.7.1" framework. Add a reference to ".NETFramework,Version=v4.7.1" in the "TargetFrameworks" property of your project file and then re-run NuGet restore.

The project targeted .net 4.71 and it had NuGet references like

<package id="log4net" version="2.0.8" targetFramework="net471" />

This is using the packages.config version of NuGet references (not the newer project based NuGet references in VS 15.9)

Visual Studio Version: 15.9

What is the cause and how to fix?

like image 674
ebol2000 Avatar asked Feb 06 '19 17:02

ebol2000


1 Answers

I had the same problem. Deleting the \bin and \obj folder in the project folder resolved this issue.

like image 110
swissben Avatar answered Oct 11 '22 21:10

swissben