mathy
mathy

Reputation: 23

Azure Pipeline dotnet push error finding nuget package

My code for the azure pipeline image

I have Problems using the azure pipeline, which will automatically pack my libraries on azure devops git and push it as a nugetpackage to artifacts.

I get the error ##[error]No packages matched the search pattern. at dotnet push

Until that step everything works. I want to pack it as a nuget so i can use it in other projects. Its a API Client i wrote for my own API.

Upvotes: 1

Views: 2468

Answers (2)

Chamika Sandamal
Chamika Sandamal

Reputation: 24312

Try using the artifact path from artifact staging directory

- task: DotNetCoreCLI@2
  displayName: 'dotnet build'
  inputs:
    command: 'build'
    arguments: '--configuration $(buildConfiguration)'
    projects: '**/*.csproj'

- task: DotNetCoreCLI@2
  displayName: "dotnet pack"
  inputs:
    command: 'pack'
    arguments: '--configuration $(buildConfiguration)'
    packagesToPack: '**/*.csproj'
    nobuild: true
    versioningScheme: 'off'

- task: NuGetCommand@2
  displayName: 'nuget push'
  inputs:
    command: 'push'
    feedsToUse: 'select'
    packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
    nuGetFeedType: 'internal'
    publishVstsFeed: '<Name of Your Feed>'
    versioningScheme: 'off'
    allowPackageConflicts: true

https://medium.com/@gstvribs/how-to-use-and-deploy-azure-devops-artifacts-on-azure-pipelines-with-dotnet-dockerized-8cebd724f752

Upvotes: 1

Krzysztof Madej
Krzysztof Madej

Reputation: 40603

Please add to dotnet pack for instance setting like this to your inputs:

packDirectory: "$(Build.ArtifactStagingDirectory)/packages"

And then to dotnet push setting like this:

packagesToPush: '$(Build.ArtifactStagingDirectory)/packages/*.*nupkg'

In your approach it simply try to find packages in defualt folder but you didn't put packages there.

Upvotes: 0

Related Questions