Skip to content
Henrik edited this page Aug 21, 2014 · 1 revision

Create a .nuspec file that conforms to the NuSpec specification.

desc "Create a NuSpec for this project"
nuspec :nuspec do |spec|
  spec.output_file = "path/to/nuspec"
  spec.id = "myproject"
  spec.version = "1.0.0"
  spec.authors = ["The Authors"]
  spec.title = "My Project"
  spec.description = "This is the description of my package."
  spec.project_url = "http://example.com"
  spec.license_url = "http://example.com/license"
  spec.dependency "Autofac", "2.4.3.700"
  spec.file "tools/*.exe", "tools"
  spec.framework_assembly "System.CoreEx", "net40"
  spec.framework_assembly "System.Reactive", "net40"
end

Required Parameters

Output File

The location of the resulting nuspec file.

output_file = "path/to/nuspec"

ID & Version

This is the unique identifier and version associated with the package.

id = "myproject"
version = "1.0.0"

Authors

The authors of the package contents (versus the owners of the package container itself).

authors = ["Some Author"]

Description

A full text description of the package.

description = "The package description here."

A long-form, line-wrapping description can be provided using Ruby's heredoc syntax.

description = <<END
This is a really long, multi-line
description of my project.
END

Optional Parameters

Title

A human friendly title of the package.

title = ""

Owners

A list of the package creators.

owners = ["John Doe"]

Summary

A summary of the package.

summary = "A summary of the package."

Language

A locale ID for the package, such as en-US.

language = "en-US"

Project URL

A URL for the home page of the package.

project_url = "http://myproject.com"

Icon URL

A URL for the image to use as the icon for the package.

icon_url = "http://myproject.com/icon.ico"

License URL

A link to the license that the package is under.

license_url = "http://myproject.com/license"

Require License Acceptance

Ensure that the package license is accepted before the package is installed.

require_license_acceptance

Tags

A list of tags and keywords that describe the package.

tags = ["foo", "bar"]

Copyright

A short copyright statement.

copyright = ""

File

Add a file or file(s) to be included in the package. The first parameter accepts wildcards according to the rules. And the second identifies the name or directory within the package.

file "tools/*.exe", "tools"

Dependency

Add a dependent package by ID and (optional) version, using the normal version range specification.

dependency "foo", "~>1.0"

Framework Assembly

Add a framework assembly by name and target framework, including: net40, net35, net20, mono, wp7.

framework_assembly "System.Reactive", "net40"

Pretty Formatting

Write the file with "pretty" whitespace.

pretty_formatting

Guidance

(none)

Clone this wiki locally