Uninstall-ChocolateyPackage ignores -File value when -FileType is MSI
I'm pretty sure that line 65 $msiArgs = "/x" should be something more like $msiArgs = "/x $file" Otherwise clients have to do something like
$env:chocolateyInstallOverride = "true" $env:chocolateyInstallArguments = "$path /quiet" Write-Debug "The current version of Chocolatey appears to contain a bug in Uninstall-ChocolateyPackage," Write-Debug "where the -File parameter value is ignored when -FileType is MSI." Write-Debug "I bypass this by setting" Write-Debug '$env:chocolateyInstallOverride = "true"' Write-Debug '$env:chocolateyInstallArguments = "$path /quiet"' Write-Debug "CType\chocolateyUninstall.ps1: running Uninstall-ChocolateyPackage -PackageName CType -FileType MSI
Thanks for reporting this. I think this needs to be fixed.
Thanks. This does put me in a bit of a pickle though, I want to keep back-compat in my package. I don't know how many packages will have this issue.
I am guessing it is quite a few - also autouninstaller is meant to remove the need for this, if the only reason you would have that uninstall script is to uninstall program. However autouninstaller is still considered a preview.
I'm willing to try out autouninstaller in a v1.005 package, if that is supported. Not sure exactly how to do that (this is my first Chocolatey package). As for Uninstall-ChocolateyPackage.ps1, it's up to you whether to deprecate this or how to handle it.
The auto-uninstaller is a feature that you can turn on within the Chocolatey Client. See here:
https://github.com/chocolatey/choco/wiki/CommandsFeature
For more information.
This is https://github.com/chocolatey/chocolatey/issues/286
@JonnMsft The workaround is to pass it as the first argument in the args.
See https://gist.github.com/ferventcoder/c6e446187d96a2436a09#file-chocolateyuninstall-ps1-L43-L46
@gep13 can you confirm if this issue is still a problem in the PowerShell helper?