We have a build definition in place created in TFS 2017, which builds a .net solution that has dependency on some of our NuGet packages, during compilation the solution restores the NuGet package from packages (global-packages) folder present at this path %userprofile%\.nuget\packages instead of downloading latest one from our internal feed.
I saw a command at this page to avoid using the global-packages folder, but when I added the nuget locals global-packages -clear argument in NuGet installer task, which is used to restore the nuget packages, the task failed with the below error saying unknown option -Clear.
The NuGet Version I am using is 3.5.0 in the task.
2019-09-05T09:27:18.8819742Z ##[section]Starting: NuGet restore $(build.sourcesdirectory)/IntelliSuiteService.sln
2019-09-05T09:27:18.8819742Z ==============================================================================
2019-09-05T09:27:18.8819742Z Task : NuGet Installer
2019-09-05T09:27:18.8819742Z Description : Installs or restores missing NuGet packages
2019-09-05T09:27:18.8819742Z Version : 0.2.31
2019-09-05T09:27:18.8819742Z Author : Microsoft Corporation
2019-09-05T09:27:18.8819742Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613747)
2019-09-05T09:27:18.8819742Z ==============================================================================
2019-09-05T09:27:19.4601187Z [command]C:\Windows\system32\chcp.com 65001
2019-09-05T09:27:19.4757465Z Active code page: 65001
2019-09-05T09:27:19.5069958Z Detected NuGet version 3.5.0.1938 / 3.5.0
2019-09-05T09:27:19.5226206Z SYSTEMVSSCONNECTION exists true
2019-09-05T09:27:19.5226206Z [command]F:\Builds\NextGen_Gated\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b\0.2.31\node_modules\nuget-task-common\NuGet\3.5.0\NuGet.exe restore -NonInteractive F:\Builds\NextGen_Gated\2\s\SuiteService.sln -NoCache nuget locals global-packages -Clear
2019-09-05T09:27:20.1007732Z Unknown option: '-Clear'
2019-09-05T09:27:20.1163983Z ##[error]Error: F:\Builds\NextGen_Gated\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b\0.2.31\node_modules\nuget-task-common\NuGet\3.5.0\NuGet.exe failed with return code: 1
2019-09-05T09:27:20.1163983Z ##[error]Packages failed to install
2019-09-05T09:27:20.1320334Z ##[section]Finishing: NuGet restore $(build.sourcesdirectory)/SuiteService.sln
nuget(because you already give the exe path) - Shayki Abramczyk