From ad27a72d334ee0bf15ba31d9dd879464c6129e03 Mon Sep 17 00:00:00 2001 From: Paul Broadwith Date: Mon, 12 Oct 2015 19:57:44 +0100 Subject: [PATCH] (GH-460) Amended Template Using 'choco new' to produce ChocolateyUninstall.ps1 for your package would result in the uninstall block never being executed as the $key variable type was wrong. Updated the script template to force the $key variable to always be an array and therefore have a Count method that can be evaluated and the uninstall block executed. Closes #460 --- .../infrastructure.app/templates/ChocolateyUninstallTemplate.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chocolatey/infrastructure.app/templates/ChocolateyUninstallTemplate.cs b/src/chocolatey/infrastructure.app/templates/ChocolateyUninstallTemplate.cs index 7a6941c0a2..3ad04a9e4d 100644 --- a/src/chocolatey/infrastructure.app/templates/ChocolateyUninstallTemplate.cs +++ b/src/chocolatey/infrastructure.app/templates/ChocolateyUninstallTemplate.cs @@ -58,7 +58,7 @@ public class ChocolateyUninstallTemplate $machine_key = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*' $machine_key6432 = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' -$key = Get-ItemProperty -Path @($machine_key6432,$machine_key, $local_key) ` +[array]$key = Get-ItemProperty -Path @($machine_key6432,$machine_key, $local_key) ` -ErrorAction SilentlyContinue ` | ? { $_.DisplayName -like ""$softwareName"" }