choco icon indicating copy to clipboard operation
choco copied to clipboard

Uninstall-ChocolateyPackage ignores -File value when -FileType is MSI

Open JonnMsft opened this issue 10 years ago • 10 comments

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

JonnMsft avatar Apr 08 '15 05:04 JonnMsft

Thanks for reporting this. I think this needs to be fixed.

ferventcoder avatar May 11 '15 15:05 ferventcoder

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.

JonnMsft avatar May 11 '15 18:05 JonnMsft

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.

ferventcoder avatar May 11 '15 18:05 ferventcoder

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.

JonnMsft avatar May 11 '15 19:05 JonnMsft

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.

gep13 avatar May 11 '15 20:05 gep13

This is https://github.com/chocolatey/chocolatey/issues/286

ferventcoder avatar May 30 '15 14:05 ferventcoder

@JonnMsft The workaround is to pass it as the first argument in the args.

ferventcoder avatar Jun 04 '15 13:06 ferventcoder

See https://gist.github.com/ferventcoder/c6e446187d96a2436a09#file-chocolateyuninstall-ps1-L43-L46

ferventcoder avatar Jun 04 '15 13:06 ferventcoder

@gep13 can you confirm if this issue is still a problem in the PowerShell helper?

pauby avatar Dec 19 '23 14:12 pauby