Anatomy Of A Chocolatey Package

In this article, I will dive into a Chocolatey package to show the important components.

When utilizing a technology, sometimes thinking of it as a “black box” is good enough. Other times IT professionals are more curious to know exactly how a technology works and what is happening in the background.

Chocolatey is one of those magic tools that does a lot to automate the way you manage software. You can certainly use it without knowing anything about what is happening behind the scenes or even what a package actually is.

Let’s Unzip

Chocolatey users NuGet technology to package software. A package has a .nupkg extension, but technically is just a zip file renamed to that extension.

Related: Chocolatey Is Quite Yummy

To download a Chocolatey package to see what is inside, we can use choco download:

The package I will use as an example is called UrBackup. It’s a free and open-source backup software that I actually maintain on the Chocolatey community repository. After using Chocolatey to download the package, it expands the important files into a folder for us to look at.

The first file we will look at is the .nuspec. This is an XML formatted file that holds metadata about the package. Information such as the package name, version, author, project URL, and description can be contained here.

Another piece of information you may find here with certain packages is its dependencies. These packages need to be installed prior to installing the package itself.

Installation Script

If we dive into the “tools” folder we find a PowerShell script called ChocolateyInstall. This is where the PowerShell install magic happens. Depending on the type of installer (MSI, EXE for example) these scripts contain silent installation parameters, the package it is installing and the checksum. Since it is a PowerShell script, this is highly customizable.


Leave a Reply

Your email address will not be published. Required fields are marked *