I am creating my first Azure pipeline and I'm running into trouble getting it to restore a Nuget package from Azure Artifacts. I have a default Yaml file and I added a Nuget Task which is supposed to point to my Artifact instance
- task: NuGetCommand@2
inputs:
command: 'restore'
restoreSolution: '**/*.sln'
feedsToUse: 'Telerik'
vstsFeed: '<guid>/a765533f-c8a7-49aa-9b83-adcf9b945be9'
includeNuGetOrg: false
There's also the default task to restore packages
- task: NuGetCommand@1
inputs:
restoreSolution: '$(solution)'
I created a Nuget.config file in the project root, with the .sln file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="Telerik" value="https://pkgs.dev.azure.com/OneHRADO/<guid>/_packaging/Telerik/nuget/v3/index.json" />
</packageSources>
</configuration>
Its throwing errors for my two projects
Errors in D:\a\1\s\HR Taxonomy Change Management\HR Taxonomy Change Management.csproj NU1101: Unable to find package Telerik.UI.for.Blazor. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, NuGetOrg
Errors in D:\a\1\s\HR Taxonomy Change Management Tests\HR Taxonomy Change Management Tests.csproj NU1101: Unable to find package Telerik.UI.for.Blazor. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, NuGetOrg
I have a suspicion its getting to the first Nuget task and it can't find the packages that are in the Artifacts and its failing.
Update: Still 'no joy'. I tried your suggestions @johnmoarr and no change. I tried removing each of the nuget (or dotnetcli) commands and switching the order. I determined one thing for sure. The 'basic' nuget command tries to get everything from nuget.org, including the Telerik package and so it fails. If I put the Artifact nuget command first, it fails for everything else.
I have ready online that you can put multiple sources in your nuget.config file like so:
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Telerik" value="https://pkgs.dev.azure.com/OneHRADO/33581106-1fd6-4092-9693-a20196c22142/_packaging/Telerik/nuget/v3/index.json" />
</packageSources>
</configuration>
I think my company has some internal scan and threw an error for this believing its a security risk to have two https sources.
I've been looking for a way to exclude packages so nuget command #1 won't try and restore what's in my Artifact but no luck yet.
