Package: NuGet Publisher task version 0.*

TFS 2017 | TFS 2015 | TFS 2013

Use this task to publish your NuGet package to a server and update your feed.

Demands

None

Arguments

Argument Description
Path/Pattern to nupkg

Specify the packages you want to publish.

  • Default value: *.nupkg;-:\packages**.nupkg
  • To publish a single package, click the ... button and select the file.
  • Use single-folder wildcards () and recursive wildcards () to publish multiple packages.
  • Use variables to specify directories. For example, if you specified $(Build.StagingDirectory)\packages as the package folder in the NuGet Packager task, you could specify $(Build.StagingDirectory)\packages\*.nupkg here.
Feed type
  • External NuGetFeed publishes to an external server such as NuGet or MyGet. After you select this option, you create and select a NuGet server endpoint.
  • Internal NuGet Feed publishes to an internal or Azure Artifacts feed. After you select this option, you specify the internal feed URL.

Advanced options

Argument Description
NuGet Arguments (Optional) Additional arguments passed to nuget push.
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: Visual Studio Build


Build: Visual Studio Build

Build your solution.

  • Solution: *.sln
  • Platform: $(BuildPlatform)
  • Configuration: $(BuildConfiguration)
Package: NuGet Packager


Package: NuGet Packager

Package your projects.

  • Path/Pattern to nuspec files: *.csproj
  • Use Build number to version package: Selected
  • Advanced, Configuration to Package: Release
Package: NuGet Publisher


Package: NuGet Publisher

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: Visual Studio Build


Build: Visual Studio Build

Build your solution.

  • Solution: *.sln
  • Platform: $(BuildPlatform)
  • Configuration: $(BuildConfiguration)
Package: NuGet Packager


Package: NuGet Packager

Package your projects.

  • Path/Pattern to nuspec files: *.csproj
  • Use Build number to version package: Selected
  • Advanced, Configuration to Package: Release
Package: NuGet Publisher


Package: NuGet Publisher

Publish your packages to NuGet.org.

  • Path/Pattern to nupkg: ***.nupkg
  • Feed type: External NuGet Feed
  • NuGet Server Endpoint:

    1. Click "New service connection", and then click Generic.
    2. On the Add New Generic Connection dialog box: