1
votes

Is it possible to use Cake to always get the latest version of a specific NuGet package? I know NuGet itself only allows you to set that at the base Nuget.config level. There are some internal packages that we would like to always get the latest version of (some of our database entities), while other internal packages we don't want to force a latest (our extensions package, for example). Right now we have to go through and manually update projects that rely on those packages, and I would like to automate those "always get latest" at build.

I don't see anything using any of the NuGet add-ins, but I am new to Cake so I'm hoping I am just missing something.

Has anyone had any luck using Cake to always retrieve the latest version on the feed for specific named packages, and just use the current packages.config version for the rest?

1

1 Answers

3
votes

The short answer is that you can do anything that you want.

Cake out of the box will attempt to adopt established best principles for reproducible builds.

With the preprocessor directive, you could simply omit the version information, and Cake/NuGet will fetch the latest version. However, once downloaded to the tools folder, Cake/NuGet will not fetch it again. What you could do is add a custom step in your bootstrapper to clear the tools folder each time before build, and then the latest version will be downloaded each time.

Note: This is NOT a recommended approach, but rather something custom for your setup.