2
votes

I am trying to create a build and release pipeline for creating a nuget package using Azure Devops. I am new to this. I have the following steps, Build Steps

The details of each step as below, Nuget Restore

Build solution

Nuget Pack

Publish Artifact

I have added a release pipeline as below, Release pipeline

with detail as below, Nuget Push

I am getting an error as below when trying to push the nuget package as below.

Error

I tried different variations of the "path to package" option in nuget push, but with no joy,

Any help is really appreciated.

3
I don't see a "NuGet Tool Installer" step. Maybe that will help? Also, can you post your logs? Especially the Package step. I want to see if it says "Successfully created package Something.nupkg".Antebios
Yes it creates an artifact is created successfully. If I add the nuget push step in Build pipeline it works fine. But the error occurs when I try to add the push step in release pipeline. What is the use of "Nuget Tool installer"?NewBieDevRo
I think I understand now. In the "Build" pipeline, the package exists in the artifact directory and can be pushed. In the "Release" pipeline the artifact does not exist there. It can only be pulled down if it is associated with a build ARTIFACT, and only then if it is published during that same "Build" pipeline, which you are doing. In the Release Pipeline definition do the association, THEN it is available in the same directory for the "Release" pipeline (\agent_work\r##\a) to do as you wish. The variable is SYSTEM.ARTIFACTSDIRECTORY or env:SYSTEM_ARTIFACTSDIRECTORY.Antebios

3 Answers

1
votes

The package location that worked for me in a release pipeline:

$(System.ArtifactsDirectory)/**/*.nupkg;!$(System.ArtifactsDirectory)/**/*.symbols.nupkg
0
votes

You should specify .nupkg in your Publish Artifact step (Path to publish field). Like this:

$(Build.ArtifactStagingDirectory)\*.nupkg;!$(Build.ArtifactStagingDirectory)\*.symbols.nupkg
0
votes

I have the same Build pipeline as you, that publishs an artifact. For the Release pipeline, here are my steps:

  • extract the *.zip to a subdirectory of build's artifact staging directory (by default, the Agent downloads all the artifacts generated by the build)
  • install recent nuget
  • run nuget push from this directory (just adjust the path)

tasks