Kontekst
Kontekst

Reputation: 1151

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

Upvotes: 4

Views: 3283

Answers (2)

Pascal Berger
Pascal Berger

Reputation: 4342

Cake itself never did download nuget.exe. The example bootstrapper for Cake Runner for .NET Framework does this in certain conditions. Example bootstrapper for Cake .NET Tool does not download nuget.exe and you need to make yourself sure to have it available, either by updating the bootstrapper, using the tool prepocessor directive in your build script, or any other mechanism outside of Cake.

Upvotes: 1

C. Augusto Proiete
C. Augusto Proiete

Reputation: 27818

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:

Upvotes: 9

Related Questions