Skip to content

Design Principles

Luca Sgroi edited this page May 2, 2017 · 6 revisions

The goal of this extension is to simplify the creation and publishing process of a NuGet package.

There are essentially two ways to create a package:

  • target exclusively a .nuspec manifest which fully describes the package's contents (see Pack-Nuspec task)
  • target directly the default project file (see Pack task); in this case NuGet uses information from the .csproj file which can be optionally combined with a .nuspec manifest

In line with Pask versioning principles, the package's version is driven by the $Version property. By default, the semantic version is used and defined in the version.txt file within the target project. If the target project does not contain a version.txt file, the semantic version will not be enforced and the default version defined by Pask will be used.

Example: override the version within the build script.

Set-Property Version -Value (Get-SemanticVersion "1.2.0")

Example: Pask.NuGet own default and release tasks to create a package out of a .nuspec file.

# Synopsis: Default task
Task . Clean, Pack-Nuspec, Test, Push-Local

# Synopsis: Release the package
Task Release Version-BuildServer, Clean, Pack-Nuspec, Test, Push

Example: Create a C# library.

Import-Task Clean, Build, New-Artifact, Pack

# Synopsis: Default task
Task . Clean, Build, New-Artifact, Pack
Clone this wiki locally