Consuming a private nuget feed in an Azure DevOps build pipeline

Dominic Burford
2 min readNov 2, 2018

--

I recently had a need to consume a private nuget feed in one of our Azure DevOps build pipelines. This was for our Xamarin Forms mobile app’s build pipeline. We wanted to use a Telerik UI nuget package in our app. In order to add a reference to this nuget package to your project, you firstly need to add your Telerik credentials into Visual Studio. This ensures that you are a fully paid up Telerik subscriber with access to the nuget package.

I needed to update the build pipeline therefore to fetch this private nuget package. After a bit of trial and error (and a few failed builds) I got this working. In Azure DevOps I needed to update the nuget restore build task to also fetch the Telerik nuget package.

- Add a Nuget restore task to your build pipeline (if you don’t already have one). This task needs to come before you build the project.
- Set the path to the project in the relevant textbox
- Set the option for Feeds in my Nuget.config (this is important as this allows you to specify credentials for consuming external nuget packages)

You should now see a Manage link which will allow you to configure the credentials to your private nuget package. Clicking on this link opens up the Service Connections that are available for your build pipeline. Add a new service connection of type Nuget. In the dialog box that is now displayed click the option for Basic Authentication and enter the following information.

- Connection name
- Feed URL
- Username
- Password

Click OK to save these credentials.

Back in your build pipeline’s nuget restore task, you should now be able to select these credentials in the dropdown. What Azure DevOps will now do, is merge these credentials into it’s default nuget.config file (or into the one you have specified under the Path to Nuget.config). Either way, whatever credentials you have specified will be merged into the nuget.config file.

And that’s basically all there is to it. Your build pipeline is now able to consume nuget packages from private feeds.

--

--

Dominic Burford
Dominic Burford

Written by Dominic Burford

A father, cyclist, vegetarian, atheist, geek and multiple award winning technical author. Loves real ale, fine wine and good music. All round decent chap.

Responses (1)