5

We're creating an internal use Cake addin for our build scripts.

We're currently publishing it as pre-release to an internal feed, we've previously consumed addins from NuGet with #addin [id] syntax like this:

#addin "Cake.FileHelpers"

Is it possible to change the default feed or specify the feed in any way? And is there a way to indicate that pre-release is allowed?

1 Answers1

7

As stated on the Preprocessor directives page on cakebuild.net, the #addin directive also supports an URI syntax (#addin nuget:[uri]?package=packageid[&parameters] ) which can be used to specify parameters like feed, version & prerelease.

Example usage:

#addin nuget:?package=Cake.Foo
#addin nuget:?package=Cake.Foo&version=1.2.3
#addin nuget:?package=Cake.Foo&prerelease
#addin nuget:https://myget.org/f/Cake/?package=Cake.Foo&prerelease

You can also override the default nuget location for all addins by specifying the NUGET_SOURCE environment variable, the --nuget_source argument to Cake or adding a config file like below

[Nuget]
Source=http://myfeed/nuget/

You save it as cake.config and place it along your build.cake file. You can read more about Cake configuration here and the default values here

But to fetch latest prerelease version I would suggest going with #addin nuget:[feedurl]?package=[packageid]&prerelease syntax.

devlead
  • 4,935
  • 15
  • 36