-
Notifications
You must be signed in to change notification settings - Fork 489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #119 (removes reg keys during uninstall) #244
base: master
Are you sure you want to change the base?
Conversation
@@ -13,8 +13,9 @@ if ($installerType -ne 'MSI') { | |||
|
|||
$uninstalled = $false | |||
$local_key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*' | |||
$machine_key = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*' | |||
$machine_key = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*' | |||
$machine_key6432 = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are the uninstalled
, local_key
, machine_key
and key
variables used? I can't see them being used anywhere (at least in this file)?
I've tried this several times and the settings for OpenLiveWriter are still on my computer. The referenced keys are gone. |
Okay. I don't I have the latest version installed. I'll try again. Thanks for letting me know. |
The local directory Is still there, even though the keys are gone. |
Oh, got it. The settings are getting reset but the folders aren't deleted. I'll add some code to remove the folders as well. |
Yes, the registry keys are gone! So good job on that. |
It seems that this issue is an inherent design problem with Squirrel. Both GitHub Atom and VSCode had issues reporting this. |
I found this. Seems like Squirrel has some events we can tap into.
|
Would this work (in
|
If you handle Squirrel events, you need to handle all of them (i.e. opting into Squirrel Events via the Attribute means that you're saying "I want to handle everything myself", which means you need to handle install and update (usually just by calling |
@hashhar, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR. |
How you feeling about this change @hashhar? I see you have a bit of stuff commented out still, do you want to remove those parts entirely before we merge? |
This is partially finished. The chocolatey uninstaller has been fixed but the squirrel uninstaller still faces the same issue. If you want to merge only the chocolatey part, I'll have to undo the last commit. |
It is now ready for merging. Just for ease of reviewing it:
|
@gep13 would you be able to quickly verify the chocolatey side of things for this PR please? |
@ScottIsAFool LGTM |
Interesting -- when I try to test this Appveyer throws an error message "Project Not Found or access denied". It opens this address: https://ci.appveyor.com/project/ScottHanselman/openlivewriter/build/1.0.229 @ScottIsAFool do you know why? |
Ah, interesting. Yeah, this is because we have moved to the dotnetfoundation's AppVeyor account and ScottH has closed his account which is what we used to be using. If @hashhar were to make an arbitrary commit to this branch and push it, it would force a rebuild on appveyor using the new account and then you can test it. |
Just deleted keys manually and files, did an install, then uninstalled, and the keys and directory are still there. When I got to the directory, there is a .dead and an Update application file left. I am not using Chocolately. |
Yup. This won't fix the normal install. This tracks only the Chocolatey part of it. I will try again for the normal installer with a fresh approach. |
@kathweaver Would you mind testing this again with the most recent change? |
@RobDolinMS The change I made only affects installations done using Chocolatey. I couldn't get the Squirrel installer to do the same thing. I'll give it another try. |
Smoke-tested https://ci.appveyor.com/api/buildjobs/2blqkh9smt88a9j4/artifacts/Releases%2FOpenLiveWriterSetup.exe without success. What is supposed to be removed? Everything under HKCU:\Software\OpenLiveWriter? Steps:
|
@ferzkopp Currently I've only been able to make it work for Chocolatey packages. I've had trouble trying to do the same with the Squirrel installer (the one you get from the .exe). I really want to try again but this year has been specially busy (final year of college) and I haven't had the time to look more into it. I'll work on it again during the Christmas week. |
@hashhar Got it. I just looked through the Squirrel documentation - it doesn't mention "Uninstall" anywhere even once. The Squirrel code also does not seem to provide a hook to call an external script on uninstall. Looks like this will be a feature request dependency for Squirrel (opened issue to track this: ). Also, the Squirrel version used by OLW is out of date: createinstaller.cmd references .\src\managed\packages\squirrel.windows.1.2.1\tools\Squirrel.exe (from Nov 5, 2015) but Squirrel is up to 1.5.1 already. Probably this should be updated as well. Question: Could one use something more standard such as WiX? I could help with that, i,e. creating a simple WiX installer config that can build an MSI (or EXE) from a bin-drop isn't hard. |
I think one of the reasons Squirrel was chosen is because it's extremely fast. I think it has hooks because I have a stale branch lying around somewhere where I tried. I'll look into more detail and report within a day. |
Squirrel issue got closed already with some info; code provides a hook via the C# based onAppUninstall event handler. Not the best design in my view due to the tight coupling of OLW code with Squirrel, but this should get the job done with few DeleteSubKeyTree() calls in the handler. |
@ferzkopp It is the best design because Squirrel's event handler is just interpreting command-line parameters on your behalf, you're free to do it yourself instead :) |
I have it working now. I'll test some more and there are a few Debug messages and exception handling to be added. I think two days would be enough for me. |
@paulcbetts I have two questions.
|
- Remove registry keys under `HKCU\SOFTWARE\OpenLiveWriter` which contain information about configured blogs. - Remove local (AppData) and roaming (Roaming) profiles. - Registers event handlers for Squirrel events.
This is working now. Could somebody manually test this?Also, should I write some tests around this? |
AppVeyor did not seem to have created a bin drop with your changes. |
All of the Squirrel hooks work the same, it's super simple - they just run your executable with a special command line, and wait for it to finish - on install, it's
So, Now that you know how it works and that it's super dumb, you can write code to handle it any way you want, as long as you guarantee that, as fast as possible, you do what you need to do for uninstall, then exit and return a zero error code
Testing Squirrel hooks is super super easy, because all you need to do is:
Unlike other install frameworks, you don't need to create an installer package whenever you want to test your custom actions, you just run the app yourself |
@hashhar I'd like to test an "official" build created by the build system - not a local build. How can one trigger AppVeyor to rebuild this branch? |
It won't ever rebuild it correctly unless I merge the commits from that other PR. I guess I should do that. 🤔 |
@ferzkopp Here, I fixed it. |
Tested the latest binary - registry cleanup worked, but the Desktop shortcut wasn't removed. It still points to |
Wow, that's weird because in my case the Desktop shortcut wasn't even created. Lemme check if I missed something. EDIT: Found the fix. It was a reported Squirrel issue and has been fixed in one of the newer packages. I'll update the nuget packages. |
Changes look good to me (although I haven't run it) |
@ScottIsAFool It works now. I had to change quite a lot. A summary here:
Also, I needed feedback on a thing. Would it be good to add a dialog box asking the user if they want to retain their preferences both at the time of a new installation or uninstallation? |
You cannot add dialogs to Squirrel installs. Your installer/uninstaller has ~15sec to finish whatever it's doing, and dialogs can block longer than that. |
I added some code to remove the registry key created at
HKCU:\Software\OpenLiveWriter
during uninstall.