CPMR0037 - Custom Action In Install With No Uninstall (script)

CPMR0037 - Custom Action In Install With No Uninstall (script)

WARNING

This rule has been marked as a Guideline

Guidelines are strong suggestions that improve the quality of a package version. These are considered something to fix for next time to increase the quality of the package. Over time Guidelines can become Requirements. A package version can be approved without addressing Guideline comments but will reduce the quality of the package.

Issue

In automation scripts (.ps1/.psm1), the package has used one of the below items without also including a chocolateyUninstall.ps1 to remove any thing changed by those items.

  • Install-ChocolateyPath
  • Install-ChocolateyEnvironmentVariable
  • Install-ChocolateyExplorerMenuItem
  • Install-ChocolateyShortcut
  • Install-ChocolateyFileAssociation
  • Install-BinFile / Generate-BinFile / Add-BinFile

NOTE

The search can also hit a false positive if it finds any of the above words in the package’s automation scripts.

Please add a chocolateyUninstall.ps1 and reverse any install actions in the uninstall.

Reasoning

The above items put the computer/machine they are installing to in a certain state. When the package is removed or uninstalled, the underlying changes to the machine should go away as well.