Skip to content
Henrik Feldt edited this page Jan 8, 2018 · 15 revisions

This task type will automatically construct nuget packages for each of the projects you've given it as an Enumerable (the assignment to #files).

The project's <Name /> element will map to the id and title nuspec attributes, unless an Id element has been given, in which case it will map to the id nuspec attribute, and <Title /> to the title nuspec attribute.

nugets_pack :create_nugets do |p|
  p.configuration = 'Release'
  p.files   = FileList['src/**/*.{csproj,fsproj,nuspec}'].
    exclude(/Tests/)
  p.output = 'build/pkg'
  p.exe     = '.paket/paket.exe'
  m = p.metadata
  m.description = 'A cool nuget'
  m.authors = 'Henrik'
  m.version = ENV['NUGET_VERSION']
  m.add_dependency "NugetId", "[1.0.0)"
end

The available metadata properties are in the nuspec specification. Translate the camel case property to snake case. You can also browse the albacore code to a list.

nugets_pack Config##no_project_dependencies

Cancel following of references between projects that cause nugets_pack to find and add as nuget dependencies, linked projects.

building a nuget symbol package

nugets_pack :create_nugets do |p|
  ...
  p.gen_symbols
  ...
end

if you have nuget gem installed

Instead of having nuget in your source you can depend on the nuget gem So in the above example you can replace "p.exe" with "p.nuget_gem_exe":

nugets_pack :create_nugets do |p|
  ...
  p.nuget_gem_exe
  ...
end

And in your gemfile add the line:

gem 'nuget'

in addition to albacore.

Opting out of prefixing mono to your executable

  p.mono_opt_out
Clone this wiki locally