Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cake NuGetRestore Could not locate nuget.exe

I have created simple .NET5 console application which can be successfully run using "dotnet restore" and "dotnet run". Application is using one package Newtonsoft.Json.

I want to restore NuGet packages using NuGetRestore() but in result I get "Could not locate nuget.exe". I am using Cake .NET Tool in version 1.1.0 and default configuration.

As far as I remember, previously when I was using Cake before version 1.0.0 nuget.exe was downloaded to 'tools' folder.

What am I missing? How to make sure nuget.exe is downloaded/provided by Cake?

enter image description here

like image 854
Kontekst Avatar asked Nov 06 '25 17:11

Kontekst


1 Answers

In order for the NuGet tool to be downloaded to the tools folder, you need to include the NuGet.CommandLine package in your Cake build script. e.g.

#tool nuget:?package=NuGet.CommandLine&version=5.9.1

Related info:

  • Example build.cake file referencing NuGet.CommandLine
  • NuGet.exe related documentation
like image 135
C. Augusto Proiete Avatar answered Nov 10 '25 14:11

C. Augusto Proiete



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!