How do I tell chocolatey a program updated itself?
This answer is based on the output of the following command:
choco outdated
As mentioned in another answer, there is no automatic way in the Open Source version of Chocolatey to update the Chocolatey Package version, based on the version of the application being updated in another way. In a licensed version of Chocolatey, this feature is available.
If you want to do the initial install of an application with Chocolatey, i.e.
choco install paint.net
and then leave the application to update itself, then the best advice would be to pin the package using the pin command. This would be done with the following command:
choco pin add -n="paint.net"
This will mean that when you run the choco upgrade all
command, assuming that you are using it, that this package will no longer be considered for an upgrade, even if a new version is found. Additionally, the output from the choco outdated
command will change to the following:
If you REALLY want to remove the entry from the choco outdated
report, but you also want to rely on the application's ability to update itself, then you should be able to run the following command:
choco upgrade paint.net --skip-automation-scripts
This tells Chocolatey to upgrade the package to the currently available version, but it will also prevent the execution of the chocolateyInstall.ps1 (and other files) file, which will mean that the application installer will never be executed. As shown here:
After running the above command, the output of the choco outdated
command then becomes:
This option exists in chocolatey, but only in the paid version. It is called the Sync Command. You may find more information about using it in the above link. A video describing the command can be found on YouTube.
Chocolatey can also do this sync automatically, as described in
Synchronize with Programs And Features (Licensed Editions Only).
A free program manager for chocolatey that does syncing is said to be Deployify, which you might try.
In a pinch, if you don't want chocolatey to update certain package(s), ignoring them, you may use the choco pin command.
To make Chocolatey aware of installed applications without running the installation scripts, use the parameter -n
, --skippowershell
, --skip-powershell
, --skipscripts
, --skip-scripts
, --skip-automation-scripts
(these are all the same switch). See
How To Install or Upgrade a Package Without Running Scripts.
You may also interface chocolatey to Microsoft's PowerShell counterpart to the Linux apt-get : OneGet, now renamed to Package management. Package Manager is Microsoft's name, while the underlying open source project is still named OneGet. You would then be able to use PowerShell as the unique interface to both Windows and chocolatey.
You may read about OneGet in the Microsoft blog
What’s New in PowerShell: Getting Started with OneGet in one line with Windows PowerShell 5.0.
OneGet is is a manager of package managers, and it supports chocolatey as a package provider. You may install it in PowerShell by using the Find-PackageProvider command:
You may then use the Install-PackageProvider command to setup the chocolatey interface (although attention as it is yet a prototype, so you will have to feel your way through):
Install-PackageProvider chocolatey -Scope CurrentUser
Here is a PowerShell example of installing Notepad++ from the chocolatey gallery:
You may find more information in the following references:
- Powershell package management – NuGet, Chocolatey and Co
- Updating apps with PowerShell 5.0 and Chocolatey