NuGet Packager task version 0.*
TFS 2017 | TFS 2015 | TFS 2013
Use this task to create a NuGet package from either a .csproj or .nuspec file.
Demands
None
Arguments
Argument | Description |
---|---|
Path/Pattern to nuspec files |
Specify .csproj files (for example,
Specify .nuspec files (for example,
To package a single file, click the ... button and select the file. To package multiple files, use single-folder wildcards ( You can use multiple patterns separated by a semicolon to create more complex queries. You can negate a pattern by prefixing it with "-:". For example, specify |
Use build number to version package |
Select if you want to use the build number to version your package. If you select this option, for the pipeline options, set the build number format to something like $(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
The build number format must be The version number is passed to nuget pack with the Versions are shown prominently on NuGet servers. For example they are listed on the Azure Artifacts feeds page and on the NuGet.org package page. |
Package Folder |
(Optional) Specify the folder where you want to put the packages. You can use a variable such as $(Build.StagingDirectory)\packages
If you leave it empty, the package will be created in the same directory that contains the .csproj or .nuspec file. |
Advanced options
Argument | Description |
---|---|
Configuration to Package |
If you are packaging a .csproj file, you must specify a configuration that you are building and that you want to package. For example: Release
|
Additional build properties |
Semicolon delimited list of properties used to build the package. For example, you could replace <description>$description$</description> in the .nuspec file this way: Description="This is a great package"
Using this argument is equivalent to supplying properties from nuget pack with the |
NuGet Arguments | (Optional) Additional arguments passed nuget pack. |
Path to NuGet.exe | (Optional) Path to your own instance of NuGet.exe. If you specify this argument, you must have your own strategy to handle authentication. |
Task control options
Examples
You want to package and publish some projects in a C# class library to your Azure Artifacts feed.
`-- Message
|-- Message.sln
`-- ShortGreeting
|-- ShortGreeting.csproj
|-- Class1.cs
`-- Properties
|-- AssemblyInfo.cs
`-- LongGreeting
|-- LongGreeting.csproj
|-- Class1.cs
`-- Properties
|-- AssemblyInfo.cs
Prepare
AssemblyInfo.cs
Make sure your AssemblyInfo.cs files contain the information you want shown in your packages. For example, AssemblyCompanyAttribute
will be shown as the author, and AssemblyDescriptionAttribute
will be shown as the description.
Variables tab
Name | Value |
---|---|
$(BuildConfiguration) |
release |
$(BuildPlatform) |
any cpu |
Options
Setting | Value |
---|---|
Build number format | $(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) |
Publish to Azure Artifacts
Make sure you've prepared the build as described above.
Create the feed
See Create a feed.
Build tasks
|
Build your solution.
|
|
Package your projects.
|
|
Publish your packages to Azure Artifacts.
|
Publish to NuGet.org
Make sure you've prepared the build as described above.
Register with NuGet.org
If you haven't already, register with NuGet.org.
Build tasks
|
Build your solution.
|
|
Package your projects.
|
|
Publish your packages to NuGet.org.
|