Automatic update NuGet Packages in Azure Pipelines

Alex Bierhaus
3 min readOct 6, 2021

Keeping up to date with the latest NuGet Packages can be very time consuming and annoying. Scripts have to be executed on the local Visual Studio at regular intervals, which then not only require valuable time, but the results also have to be tested extensively afterwards.

Often the packages have to be rolled back, because they are not compatible or the own unit tests fail.

Fortunately, there is also a possibility in .NET to automate this process to a large extent and to integrate it into your Azure Pipeline Flow.

With the NuKeeper extension and Azure DevOps pipeline you can:
- Perform updates automatically
- Generate pull requests
- Automatically build & test them
- Merge via git-flow

Installation NuKeeper

Installation of NuKeeper is quite simply. Just follow NuKeeper — Visual Studio Marketplace and give it permission to your org.

Set Up Pipeline

In your Azure DevOps environment move to the pipeline page and simply create a new pipeline.

Create new piepline
  1. In the next window choose the classic editor

2. Choose your main repository

3. Allow scripts to access the OAuth token

4. Add “NuKeeper” as task and just select the Azure Artifacts feed

Save the package.

You can find the exported YAML for the pipeline here: Azure Pipeline NuKeeper Configuration (github.com)

Setup Permission

In order to create Pull Requests the NuKeeper underlying service worker/ user needs permission

  1. Switch to the Procect Settings -> All Repositories -> Security
  2. Give the Project Build Service access to following types

Run & Schedule

Go back to your created pipeline and configure a daily schedule run. This will automaticaly checks for updates every day

Start the Pipeline manually. After completing you will find newly created Pull Requests in the Active tab

Results for Pull Requests
Example for NuKeeper Pull Request

Conclusion

In this article, we learned how to use NuKeeper and Azure Pipelines to automate the process of automatically updating NuGet processes to a large extent.
It is advisable to include this in your own CI/CD process.

--

--

Alex Bierhaus

Entrepreneur — technologist — passionate leader