This article is more than 1 year old
Microsoft releases command-line package manager for Windows (there are snags)
Nice try, but package management will never work as well on Windows as it does on Linux
Microsoft has released Windows Package Manager 1.0, better known as winget, a command line tool for adding, removing and updating what is installed on the system.
The Windows Package Manager has a number of arguments through which users can inspect what is installed as well as adding, removing or updating applications
Linux users accustomed to package managers like Apt and Yum – where (if all is going well) applications as well as developer tools and libraries can be managed with simple commands and reboots are rarely required – would love to have a similar experience on Windows.
Third-party options like Chocolatey have existed for a while, but at Build last year Microsoft introduced Winget, saying that "just about every developer has wanted a native package manager in Windows."
Microsoft said that it needed its own first-party package manager, despite the existence of others, in order to manage its own repository of "trusted applications" as well as integrating it with Windows.
The project got off to a bad start when the developer of AppGet, another existing solution, said that Microsoft approached him with what at first appeared to be a job offer and then, having heard all his suggestions, came up with its own solution using many of the same ideas. The company gave a belated acknowledgment of the issue.
Now, one year on, Winget 1.0 has been released. The features include searching for new packages, listing what is installed, and upgrading or removing them.
Users can get WinGet by installing an application called App Installer from the Windows Store (there are some teething problems with this process).
There are currently over 1,400 packages in the Microsoft Community Repository, according to senior program manager Demitrius Nelon. He also introduced another tool, in preview, called Windows Package Manager Manifest Creator, to generate the manifest needed to submit new packages to the repository.
A nice feature of Winget is that it can manage existing applications installed via the Windows Store or visible in Add/Remove Programs in Control Panel.
Developers can see how many versions of Java they have accumulated with a command like winget list java, for example. The application does not yet fully support the Windows Store though, in that search will not find everything available there (probably a good thing), but only a select subset. There is therefore no provision yet for purchasing software through Winget.
The Reg gives it a spin
Winget will be useful; but dig into it a little and issues soon emerge. We used winget to list LibreOffice installs, and it showed that an old version was installed. Running upgrade downloaded a new installer and verified its installer hash (good), but then said "Installer failed with exit code: 1603". A log is generated (also good) which showed that the installer required elevation; this should happen via a prompt, but for some reason did not work in this case.
The solution was to run Winget as administrator, though the docs say: "Always use caution when running your command prompt as an administrator, and only install applications you trust." Indeed.
Winget shows when an updated version of a package is available – but upgrading may not be straightforward
Unfortunately the LibreOffice install failed again, this time with error 3010. This one was not so bad: the installation completed successfully, but the log noted: "Restart required. The product installation or update required a restart for all changes to take effect. The restart was deferred to a later time."
The reason for this is that Winget runs msiexec (the command-line tool for installer packages) with the arguments /qn /norestart, which means "install without a user interface and do not force a restart."
Installing without a user interface may seem convenient, but what about all the important options that complex installs like LibreOffice would normally offer you? The restart thing is a problem too: not restarting is great, but it's frustrating when the application is not fully installed.
This sort of problem comes about because Windows, for both design and legacy reasons, is not as well-suited to package management as Linux. Microsoft has worked hard to steer developers down the route of Windows Store and MSIX packages, but there are plenty of popular applications that do not yet follow this guidance.
"Windows has no proper packages, just various unrelated unmanaged ways of installing things. MSIX might be close, but it comes with so many issues that it's not an option - more on that later. Windows has no centralized repository for software and the store is a massive disaster in many ways," said one user on GitHub.
While an extreme position, there is some truth in this. Winget could, perhaps, be part of the solution, if working nicely with it becomes something businesses demand. The debate from which this comment is taken, however, illustrates the dilemma well. The question was whether to drop support for applications with legacy installers that are not transactional and have unpredictable behaviour.
Drop such support, and Winget would be less useful. Maintain it, and Windows trundles on, seemingly never escaping its disorganized past. ®