1
votes

I have a Xamarin Forms project for which I am using a private Telerik nuget feed (we're using their UI controls).

In the Azure DevOps build pipeline I have added a new service connection to the Telerik nuget feed.

enter image description here

In my build pipeline I have a nuget task that restores these packages.

enter image description here

However my build fails with the error "Unable to resolve Telerik.UI.for.Xamarin".

enter image description here

My understanding of configuring a private nuget feed may be incorrect. Do I need to specify a nuget.config file that specifies the Telerik nuget package? Do I need to remove the reference to the Telerik package from the .csproj? (i.e. do I need to separate out my private nuget packages to prevent the build from attempting to download them?)

2

2 Answers

0
votes

After some trial and error I have eventually managed to fix this issue by creating a nuget.config file for my project and adding the following entries.

<?xml version="1.0"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
  </packageSources>
  <packageRestore>
    <add key="enabled" value="true" />
    <add key="automatic" value="true" />
  </packageRestore>
</configuration>

These are just default values that allow my project to fetch the packages from nuget.org. The service credentials that I have configured for fetching packages from the private Telerik nuget feed are then merged into this nuget.config file during the build. The build is therefore able to fetch both the default packages from nuget.org as well as the private Telerik feed.

0
votes

In our case, the problem was a trailing slash. In our nuget.config file, we had the endpoint specified as https://nuget.telerik.com/nuget/, but in the Service Connection in Azure DevOps it was specified as https://nuget.telerik.com/nuget (note the lack of a trailing slash!).

It's a bit annoying that Azure DevOps is that particular about it, but once we eventually saw the difference and removed the trailing slash from nuget.config, everything works as expected.