5
votes

I am trying to implement CI/CD on Azure DevOps for my Asp.net Core project.

Project having Nuget packages from three different sources:

enter image description here

MSBUild in Azure Pipeline is going to find nuget packages in Offline Packages or Nuget.org only but not going to find external source which i am also using: http://dev-abc-api-nugetserver-wi.azurewebsites.net/nuget/

I have tried below code in Azure Pipeline Build but that didn't work

/p:RestoreAdditionalSources="http://dev-abc-api-nugetserver-wi.azurewebsites.net/nuget/"  /t:Rebuild

But still receiving same error:

Error NU1101: Unable to find package abc.Core.Services. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, nuget.org

My build pipeline:

enter image description here

1
Can you share your pipeline?Shayki Abramczyk
added snapshot of pipelineSagar Modi
try to add a NuGet restore task and specify your nuget.config (in the nuget.config put your private repo)Shayki Abramczyk
this is asp.Net CORE project so doesn't have nuget.configSagar Modi
you can create a nuget.config and commit/check in to your solution, then try to run dotnet restore before your build.Shayki Abramczyk

1 Answers

6
votes

You need to create nuget.config file (and commit/check in to your project), in the file you need specify your NuGet sources (include your external source).

In your build pipeline add .Net core task with the restore command, specify your .csproj file and check the "Feeds in my NuGet config", create a NuGet endpoint with username & password for your external nuget repo.

enter image description here

After this task all your packages should be downloaded and the build should be run successfully.