简体   繁体   中英

Azure devops private nuget takes a long time to find package

We are using Azure DevOps pipelines. We have a step that publishes the our private nuget package to the Azure Artifacts. However, the build breaks at other steps because the nuget package (that was published on previous steps) is not found. The strange thing is that after the package is published, I can see it in the package-manager console or on Visual Studio and even in the Artifacts in Azure DevOps. But for some reason, the pipeline doesn't find the package. After 30-50min, I re-run the pipeline and then it finds the package.

What could be happening to take so long time for the pipeline to find the my package?

Edit 1:

This is my yaml for the step with error

- script: |
        pwd && ls -la 
        dotnet restore "$(solution_path)" $(nuget_args)
        dotnet publish -c Release -o $(System.DefaultWorkingDirectory)/bin "$(main_project_path)"
        mkdir artifact
        cp -r $(System.DefaultWorkingDirectory)/bin artifact/bin
      displayName: Build Application

The error is:

/data/vstsagent/user/389/s/src/MyProject.csproj: error NU1102: Unable to find package MyPackage with version (>= 2.1.0) [/data/vstsagent/user/389/s/src/MySolution.sln] /data/vstsagent/user/389/s/src/MyProject.csproj: error NU1102: - Found 28 version(s) in MyPrivateRepository [ Nearest version: 2.1.0-preview.6 ] [/data/vstsagent/user/389/s/src/MySolution.sln]

It is not clear what feed is used by dotnet restore command.

  1. Confirm that you have configured your custom nuget feed in nuget.config and using it.
  2. Try adding "--verbose" switch in dotnet restore command and check if your feed is used for restoring packages.

Use the --no-cache option so do.net restore doesn't use the local cache.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM