GetReferenceNearestTargetFrameworkTask not found

Ranorex Studio, Spy, Recorder, and Driver.
jonny
Posts: 11
Joined: Thu Oct 31, 2019 4:24 pm

GetReferenceNearestTargetFrameworkTask not found

Post by jonny » Fri Mar 20, 2020 4:07 pm

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

foals11
Posts: 20
Joined: Wed Sep 18, 2019 9:19 am

Re: GetReferenceNearestTargetFrameworkTask not found

Post by foals11 » Mon Mar 23, 2020 8:46 am

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

NehaMavani
Posts: 4
Joined: Wed Apr 08, 2020 7:26 am

Re: GetReferenceNearestTargetFrameworkTask not found

Post by NehaMavani » Fri Apr 10, 2020 8:32 am

Hi. Ikeep facing the same problem. Tried both the solutions. Didn't work. Do we have any other alternative here?

Vega
Posts: 222
Joined: Tue Jan 17, 2023 7:50 pm

Re: GetReferenceNearestTargetFrameworkTask not found

Post by Vega » Thu Apr 16, 2020 12:27 am

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

jonny
Posts: 11
Joined: Thu Oct 31, 2019 4:24 pm

Re: GetReferenceNearestTargetFrameworkTask not found

Post by jonny » Tue Oct 20, 2020 5:17 pm

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