NuGetPackager@0 - NuGet packager v0 task

NuGetPackager@0 is deprecated. Use the NuGet task instead. It works with the new Tool Installer framework so you can easily use new versions of NuGet without waiting for a task update, provides better support for authenticated feeds outside this organization/collection, and uses NuGet 4 by default.

NuGetPackager@0 is deprecated. Use the NuGet task instead. It works with the new Tool Installer framework so you can easily use new versions of NuGet without waiting for a task update, provides better support for authenticated feeds outside this account/collection, and uses NuGet 4 by default.

Syntax

# NuGet packager v0
# Deprecated: use the “NuGet” task instead. It works with the new Tool Installer framework so you can easily use new versions of NuGet without waiting for a task update, provides better support for authenticated feeds outside this organization/collection, and uses NuGet 4 by default.
- task: NuGetPackager@0
  inputs:
    searchPattern: '**\*.csproj' # string. Required. Path to csproj or nuspec file(s) to pack. Default: **\*.csproj.
    #outputdir: # string. Package Folder. 
  # Pack options
    #includeReferencedProjects: false # boolean. Include referenced projects. Default: false.
    versionByBuild: 'false' # 'false' | 'byPrereleaseNumber' | 'byEnvVar' | 'true'. Required. Automatic package versioning. Default: false.
    #versionEnvVar: # string. Required when versionByBuild = byEnvVar. Environment variable. 
    #requestedMajorVersion: '1' # string. Required when versionByBuild = byPrereleaseNumber. Major. Default: 1.
    #requestedMinorVersion: '0' # string. Required when versionByBuild = byPrereleaseNumber. Minor. Default: 0.
    #requestedPatchVersion: '0' # string. Required when versionByBuild = byPrereleaseNumber. Patch. Default: 0.
  # Advanced
    #configurationToPack: '$(BuildConfiguration)' # string. Configuration to Package. Default: $(BuildConfiguration).
    #buildProperties: # string. Additional build properties. 
    #nuGetAdditionalArgs: # string. NuGet Arguments. 
    #nuGetPath: # string. Path to NuGet.exe.
# NuGet Packager v0
# Deprecated: use the “NuGet” task instead. It works with the new Tool Installer framework so you can easily use new versions of NuGet without waiting for a task update, provides better support for authenticated feeds outside this account/collection, and uses NuGet 4 by default.
- task: NuGetPackager@0
  inputs:
    searchPattern: '**\*.csproj' # string. Required. Path to csproj or nuspec file(s) to pack. Default: **\*.csproj.
    #outputdir: # string. Package Folder. 
  # Pack options
    #includeReferencedProjects: false # boolean. Include referenced projects. Default: false.
    versionByBuild: 'false' # 'false' | 'byPrereleaseNumber' | 'byEnvVar' | 'true'. Required. Automatic package versioning. Default: false.
    #versionEnvVar: # string. Required when versionByBuild = byEnvVar. Environment variable. 
    #requestedMajorVersion: '1' # string. Required when versionByBuild = byPrereleaseNumber. Major. Default: 1.
    #requestedMinorVersion: '0' # string. Required when versionByBuild = byPrereleaseNumber. Minor. Default: 0.
    #requestedPatchVersion: '0' # string. Required when versionByBuild = byPrereleaseNumber. Patch. Default: 0.
  # Advanced
    #configurationToPack: '$(BuildConfiguration)' # string. Configuration to Package. Default: $(BuildConfiguration).
    #buildProperties: # string. Additional build properties. 
    #nuGetAdditionalArgs: # string. NuGet Arguments. 
    #nuGetPath: # string. Path to NuGet.exe.

Inputs

searchPattern - Path to csproj or nuspec file(s) to pack
string. Required. Default value: **\*.csproj.

The pattern that the task uses to search for csproj or nuspec files to pack.

You can separate multiple patterns with a semicolon, and you can make a pattern negative by prefixing it with -:. Example: **\*.csproj;-:**\*.Tests.csproj.


outputdir - Package Folder
string.

The folder where the task creates packages. If this string is empty, packages will be created in the folder where the csproj or nuspec file is located.


includeReferencedProjects - Include referenced projects
boolean. Default value: false.

Includes referenced projects either as dependencies or as part of the package. Cannot be used with automatic package versioning. If a referenced project has a corresponding nuspec file that has the same name as the project, then that referenced project is added as a dependency. Otherwise, the referenced project is added as part of the package. Learn more about using the pack command for NuGet CLI to create NuGet packages.


versionByBuild - Automatic package versioning
string. Required. Allowed values: false (Off), byPrereleaseNumber (Use the date and time), byEnvVar (Use an environment variable), true (Use the build number). Default value: false.

Applies automatic package versioning depending on the specified value. This string cannot be used with includeReferencedProjects. The allowed values are:

  • byPrereleaseNumber - Use the date and time: The task will generate a SemVer-compliant version formatted as X.Y.Z-ci-datetime, where you specify the values of X, Y, and Z.
  • byEnvVar- Use an environment variable: The task will use an environment variable that you specify and contains the version number you want to use.
  • true - Use the build number: The task will use the build number to version the package.

Note

Under General, set the build format to be $(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r).


versionEnvVar - Environment variable
string. Required when versionByBuild = byEnvVar.

Specifies the variable name without $, $env, or %.


requestedMajorVersion - Major
string. Required when versionByBuild = byPrereleaseNumber. Default value: 1.

The X in version X.Y.Z.


requestedMinorVersion - Minor
string. Required when versionByBuild = byPrereleaseNumber. Default value: 0.

The Y in version X.Y.Z.


requestedPatchVersion - Patch
string. Required when versionByBuild = byPrereleaseNumber. Default value: 0.

The Z in version X.Y.Z.


configurationToPack - Configuration to Package
string. Default value: $(BuildConfiguration).

Specifies the configuration to package when using a csproj file.


buildProperties - Additional build properties
string.

The semicolon delimited list of properties used to build the package.


nuGetAdditionalArgs - NuGet Arguments
string.

The additional arguments passed to NuGet.exe pack. Learn more about using the pack command for NuGet CLI to create NuGet packages.


nuGetPath - Path to NuGet.exe
string.

Optional. Supplies the path to NuGet.exe.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands Self-hosted agents must have capabilities that match the following demands to run jobs that use this task: Cmd
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 1.83.0 or greater
Task category Package