1

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.

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
mathy
  • 23
  • 7
  • why dont you use azure artifacts? – Chamika Sandamal May 16 '21 at 19:00
  • thats what i try to do. I coded a net5.0 api client lib for my web api i have. and i wanna package and push it to artifacts, so i can use it in my other applications. Is my approach wrong with this pipeline? It should automatically generate a new nuget pkg whenever i change my api client lib. – mathy May 16 '21 at 21:09

2 Answers2

1

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

Chamika Sandamal
  • 23,565
  • 5
  • 63
  • 86
0

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.

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
  • hi, thats not working :/ it still says the package with this pattern was not found at nuget push – mathy May 16 '21 at 22:17