Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The "GetReferenceNearestTargetFrameworkTask" task was not found

I have a problem with autocompletion in VS 2017 Community.

Previously I had VS 2017 Enterprise from school, but the key expired so I moved to Community.

Before, everything works great, but now it doesn't work at all.

I found a solution on Stack Overflow here but it doesn't work, so found another solution at GitHub here.

And I got this:

Build FAILED.

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1601,5): error MSB4036: The "GetReferenceNearestTargetFrameworkTask" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with in the project file, or in the *.tasks files located in the "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin" directory. 0 Warning(s) 1 Error(s)

Time Elapsed 00:00:00.11

Do you know what to do next?

like image 583
LadIQe Avatar asked Dec 13 '17 16:12

LadIQe


1 Answers

I had the same error message but for a different problem.

So, I'm using MSBuild to automate build/deploy process for Azure Functions. Everything was working fine until I updated both Visual Studio 2017 and Visual Studio Build Tools 2017 at which point I started getting this error. To be precise I got this error only when using MSBuild, building project manually from VS was working fine.

In my case I already had everything set as per @Programmer's answer. But as I was using MSBuild it turned out that I also had to install NuGet targets and build tasks which are part of Visual Studio Build Tools.

Screenshot of Visual Studio Installer

like image 78
Nemanja Milosevic Avatar answered Oct 17 '22 04:10

Nemanja Milosevic