Getting started with winget, the Windows Package Manager


Windows developers have long looked at Linux’s surfeit of package managers with envy. Having a simple command line tool like apt or rpm that would install an application and all its prerequisites makes installing a toolchain easy; all you need is a script that chains together a list of tools. Press return, and you’re ready to go.

That’s never been the case in Microsoft environments, at least not until the Azure CLI and ARM templates. But they’re only for the cloud or for Azure Arc managed systems. They work at a higher level than tools that install an editor, a utility, or a compiler, delivering complete infrastructures. Windows users have had the option of the third-party Chocolatey, building on PowerShell and working with Windows’ native installers, but it means either buying into the Chocolatey ecosystem as an organization or going out of your way to find and install the free desktop client.

Introducing winget

There’s definitely strong demand for a command line-driven package installer in Windows, and Microsoft has finally noticed. In 2020 it announced Windows Package Manager and winget, a package manager that’s being built-in to the Windows App Installer tools. Currently available to Windows Insiders in a preview release of App Installer, winget is also downloadable from GitHub for Windows 10 Version 1709 and later. Alternatively, you can build it from the project source code using Visual Studio 2019 with its desktop development tools for .NET, C++, and UWP. There’s even a separate Insiders program with its own mailing list.

Winget is the first iteration of a built-in package manager for Windows, closely related to various open source alternatives, especially AppGet. It is being built in public on GitHub. It has a similar architecture to most package managers, using application manifests to describe applications and their requirements, with a central managed repository for manifests, each of which links to download sites for application installers.

Once installed, winget behaves like any other command line tool, and can be accessed from either the Windows command line or from PowerShell. It has a built-in search function that can find a specific package or display the entire list of available packages. To get the complete list of packages type winget search. If you want a local catalog, pipe the output to a file to get a text file with all 1,350 current packages.

Running the winget client

Installing an app from the repository is relatively simple. All you need to do is find the name of the application using search, then run winget install. You can use a query as part of the install instead of a full package name; additional options allow you to choose specific versions (the default is to install the latest release), how the installer runs, and even where the file should be installed. It’s a quick process, and as apps are installed using standard Windows installers, they can be uninstalled using familiar Windows settings.

Copyright © 2021 IDG Communications, Inc.



Source link