Azure Pipelines: "No packages matched the search pattern."

Viewed 5329

I am writing a YAML pipeline that should publish a NuGet package.

When coming to the deployment job I get a warning: "No packages matched the search pattern." The package is there and it is confirmed by the log

Downloaded drop/PackageName.1.0.0.nupkg to d:\a\1\drop\PackageName.1.0.0.nupkg

and the variable packagesToPush is set to **/*.nupkg;!**/*.symbols.nupkg.

What am I missing here?

I also tried with different folders like $(Build.ArtifactgDirectory)/**/*.nupkg;!$(Build.ArtifactDirectory)/**/*.symbols.nupkg

6 Answers

You should use $(System.DefaultWorkingDirectory) instead of $(Build.ArtifactgDirectory).

$(System.DefaultWorkingDirectory)/**/*.nupkg;!$(System.DefaultWorkingDirectory)/**/*.symbols.nupkg

After multiple attempts, this works:

'$(Pipeline.Workspace)/**/drop/*.nupkg'

We are running on Windows agents and had to use backward slashes:

$(System.DefaultWorkingDirectory)\**\*.nupkg

you have a typo in ArtifactgDirectory.

Today I checked and this is the only one that worked for me:

$(System.DefaultWorkingDirectory)/_ArtifactSourceAlias/drop/*.nupkg

Change _ArtifactSourceAlias with your project name.

Or see the below image to see where to find it. Source Alias Textbox enter image description here

happy testing!!!

Pay attention to you back or forward slashes if you work with a linux vmImage

For me the problem was back slashes (Wrong path: '<path>\<project name>.csproj' for ubuntu-latest)

...
      vmImage: ubuntu-latest #Part of the problem

  - task: DotNetCoreCLI@2
      inputs:
        command: 'restore'
        projects: '<path>/<project name>.csproj' #Correct! path for ubuntu-latest
...
Related