ebol2000
ebol2000

Reputation: 1283

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?

Upvotes: 12

Views: 4129

Answers (2)

swissben
swissben

Reputation: 1077

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

Upvotes: 27

ebol2000
ebol2000

Reputation: 1283

I didn't find the cause, but when I converted the NuGet packages.config to package references it resolved the issue.

Looks this this is the same issue.

Upvotes: 0

Related Questions