9
votes

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?

2

2 Answers

19
votes

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

0
votes

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.