So I've been trying out OneGet for a while and wanted to create packages. The biggest problem I've run into is that OneGet does not seem to actually execute the uninstall script provided into the package.
This is the .nuspec file and the script files I've been testing with:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>notepadplusplus</id>
<version>6.8.5</version>
<title>Notepad++</title>
<authors>Notepad ppl</authors>
<owners>King Kong</owners>
<projectUrl>https://notepad-plus-plus.org/</projectUrl>
<iconUrl>http://i1-win.softpedia-static.com/screenshots/icon-60/Notepad-plus-plus.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Notepad++ is a free (as in "free speech" and also as in "free beer") source code editor and Notepad replacement that supports several languages. Running in the MS Windows environment, its use is governed by GPL License.</description>
<summary>Notepad++</summary>
<tags>notepad notepad++ texteditor text editor</tags>
</metadata>
<files>
<file src="tools\chocolateyInstall.ps1" target="tools\chocolateyInstall.ps1" />
<file src="tools\chocolateyUninstall.ps1" target="tools\chocolateyUninstall.ps1" />
</files>
</package>
chocolateyinstall.ps1:
Install-ChocolateyPackage 'notepadplusplus' 'exe' '/S' 'https://notepad-plus-plus.org/repository/6.x/6.8.5/npp.6.8.5.Installer.exe'
chocolateyuninstall.ps1:
Get-WmiObject -Class Win32_Product | Select-Object -Property Name > C:\foo.txt
I use the uninstall script just to test if the script is even run but it's not. When I do the same to the install script I can clearly see that it hit the script and actually create the text file.
So my question is does the oneget module in Windows 10 not use the script files at all? Since Doing an Uninstall-package seems to execute the uninstall file if the name provided is the exact same as in the registry. For example doing the command Uninstall-package notepad++
will uninstall notepad++ even though it was installed with the name notepadplusplus.
The current OneGet Chocolatey provider is a non-fully featured prototype from March 2014 (yes, 2014), written by Microsoft. The official provider is not done. Look for that to be finished sometime in 2017. The Chocolatey team uses a prioritization schedule that allows for quickly reprioritizing when demands shift, so it is hard to provide better estimated dates on this. If anyone is interested in picking this up to finish, please comment below.
We'll make an official announcement in the mailing list and in the newsletter when it is ready.
Until it is announced, I would expect it to be an early preview and pretty much consider everything about it broken (including security fixes that have been added since 2014). It's based currently on Chocolatey from nearly two years ago and not even fully functional to the features available then.
HTH