Page 1 of 1

GetReferenceNearestTargetFrameworkTask not found

Posted: Fri Mar 20, 2020 4:07 pm
by jonny
This question is in relation to https://www.ranorex.com/forum/masked-va ... 15733.html. I had been RDP'ing into my other system due to the current health situation. But to address the response in that question. I uninstalled my license and installed the latest version 9.3.1 of Ranorex to my Windows 10 machine so I don't have to RDP in. This is a fresh install and I started a new project. Unfortunately, to test whether this fixes the linked question above, I am getting this error?
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 <UsingTask> in the project file, or in the *.tasks files located in the "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin" directory. (MSB4036) - C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets:1657,5
I am running Ranorex as an admin additionally

Thanks

Jonny

Re: GetReferenceNearestTargetFrameworkTask not found

Posted: Mon Mar 23, 2020 8:46 am
by foals11
Hi,

Try both solutions that are mentioned in this stackoverflow post? Try to install the NuGet targets and build tasks and the NuGet package manager from the Visual Studio installer.

https://stackoverflow.com/questions/477 ... -not-found

regards

Re: GetReferenceNearestTargetFrameworkTask not found

Posted: Fri Apr 10, 2020 8:32 am
by NehaMavani
Hi. Ikeep facing the same problem. Tried both the solutions. Didn't work. Do we have any other alternative here?

Re: GetReferenceNearestTargetFrameworkTask not found

Posted: Thu Apr 16, 2020 12:27 am
by Vega
Is this showing as a warning or an error when you try to build? Do you know if you happen to have the 4.6.2 developer pack installed?

https://dotnet.microsoft.com/download/t ... loper-pack

hope this helps

Re: GetReferenceNearestTargetFrameworkTask not found

Posted: Tue Oct 20, 2020 5:17 pm
by jonny
This answer fixed my problem: https://stackoverflow.com/a/49577055/895169



I was seeing this issue with msbuild 15.6.82 on a build environment that does not have VisualStudio 2017, only VS Build Tools.

Here's a PowerShell script that resolves this issue, it pretty much does the equivalent of previous answers in the VS Installer, but silently and waiting for completion.

Start-Process "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList 'modify --installPath "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools" --quiet --add Microsoft.VisualStudio.Component.NuGet.BuildTools --add Microsoft.Net.Component.4.5.TargetingPack --norestart --force' -Wait -PassThru