Chocolatey is a tool for automating and simplifying application installs. It is based on NuGet and contains similar commands. Instead of installing developer packages, it installs applications. This tutorial provides an overview of Chocolatey and explains the problem that is solves. Plus, it explores the similarities and differences between NuGet and Chocolatey.
- [Voiceover] Most users don't think too much about application installers, but the developer crowd likes to automate procedures when possible. Chocolatey is one solution to automating and simplifying application installs. Here's an example of the problem. We get our installer exe from an application vendor. Usually from their website. We download the exe to our computer and run the installer. Then we step our way though a series of option dialogs, and keep clicking until the application is installed. It's an easy method but requires manual interaction. A few hours later, we need to install another application, so we go to a different website, dig through their pages until we find the download link.
Download the msi file, and step through another install process. The next day, we need to install an image editor, but we need an older version. That takes a long time to find on the vendor site, because their older versions are buried deep within the site Once again, we download the exe and step through the installer screens to install the application. We're performing the same tasks over, and over, and sometimes we have a hard time finding the correct versions to install, and on top of that , some applications have dependencies on other applications, which means we have to install that application too.
At this point, the bells are ringing in your head. This sounds familiar. This is the same scenario that NuGet addresses with application libraries. Someone else thought the same thing, and build an application named Chocolaty NuGet to solve the problem. Rather than create a system similar to NuGet, the Chocolatey author decided to build on top of the NuGet infrastructure. His inspiration was the Advanced Package Tool included in the Debian Linux distribution. If you've never used Debian, here's a quick overview. APT is a system level package manager. Every application, every component, every part of the operating system is built into a package and can be updated, installed, and uninstalled with APT.
Chocolatey is an attempt to implement a similar system in Windows, and it's been largely successful. Since Chocolatey is based on NuGet, many of the features we looked at elsewhere in this course apply. Here are some of the similarities. Both systems use a standard package format. To create a package, you provide a package manifest and a collection of files. Once the package is ready, it's uploaded to a repository where it is accessible to the package consumers. NuGet and Chocolatey handle the package installs, updates, rollbacks, installing alternate versions, and listing of packages, but there are differences too.
NuGet is optimized for installing developer packages, which are programmer libraries and API's. Chocolatey installs standard Windows applications. NuGet packages are installed into the video studio solution folders. Chocolatey installs the application into the normal application folder. In other words, if I install Google Chrome without Chocolatey, it goes in the program files folder. Installing Chrome with Chocolatey results in it being installed in the same folder. Both NuGet and Chocolatey have public repositories. Obviously they're in different locations. You'll find the Chocolatey Gallery at chocolatey.org.
Both systems permit private repositories too. This might be really important to you. Especially if you are part of a company with strict installation policies. If your IT department frowns on employees installing arbitrary applications from the internet, they are not gonna like Chocolatey, but if you create a private Chocolatey repository behind the company firewall and have only trusted packages available there, then you are more likely to get corporate approval to use Chocolatey NuGet packages are managed with the visual studios tools. Chocolatey packages are managed with PowerShell.
NuGet seamlessly uninstalls packages. Removing all traces of them from the packages.config file, and removing the files from the solution folder. Chocolatey has a slightly more complex uninstall process. It uninstalls the packages, but it does not uninstall the actual application, but since the applications are normal Windows applications, you can use the normal Windows uninstall tools. Here's an important point to understand. A Chocolatey package is really just a wrapper around the real application installer. When you install the Chocolatey package, the Chocolatey app reads the information in the package file.
Then it gets the real installer from the specified location on the internet and copies it to your computer. Next it runs the installer for you, silently suppressing any install dialogs that would appear that would appear in the real installer. Overall it's a great system. You can install apps quickly and silently, with minimal input from you. Plus, you can bash together multiple installs and updates, saving even more time. Let's get started exploring Chocolatey.
- What is a package manager?
- Installing NuGet in Visual Studio
- Installing and managing packages
- Updating packages
- Working with PowerShell and NuGet
- Finding packages with NuGet Gallery and ASP.NET MVC
- Using Package Restore
- Using the Chocolatey machine packet manager
- Using Boxstarter for creating installation packages
- Using OneGet/PackageManagement
- Creating, publishing, and installing a custom NuGet package