View Full Version : Uninstall does not remove any files
10-21-2003, 05:44 PM
I have created a Major upgrade to clean up a dodgy previous version. All looks clean after installation however, when clicking Add/Remove programs, the uninstallation removes all entries from the regsitry but the INSTALLDIR remains with all files still there. IF I manually delete the INSTALLDIR in windows explorer I have a perfect uninstall.
Why is Add/Remove programs not removing the INSTALLDIR ?
10-22-2003, 10:50 AM
The problem you have mentioned appears due to 'Permanent' option of component. It seems you have set this option to 'Yes' which will not delete the component during uninstallation. Hence, the component installing files in INSTALLDIR will not get deleted.
I suggest you check this option for all the components. It should be set to 'No' for complete uninstallation.
10-22-2003, 05:19 PM
Unfortunately this is not the problem. Every component has the Permanent option set to NO.
The version I am upgrading from did not uninstall correctly either so I guess the problem is being carried over. But I thought this being a MAJOR upgrade, the problem would be resolved.....obviously not.
The components are marked as shared. Could this be the reason ?
What ever the reason for the files not being uninstalled, is there some workaround I can try, some way of forcing all files to be deleted from the INSTALLDIR upon uninstallation?
10-23-2003, 08:16 AM
We had a similar problem; the cause seemed to be related to the shared counts in the Windows Shared Dlls key being updated incorrectly so the count didn't reach zero on uninstall and the files were not removed. You might check those keys to see if the count in them is higher than it should be for the components marked shared.
To solve it, I wrote a function in the script that looked for and deleted those keys in the registry before my uninstall ran for the major upgrade; once those keys were gone, the components uninstalled with no problem. Of course, I knew that no application other than the one I was dealing with used those components, so if yours are truly shared among products, this method could be problematic for you.
10-23-2003, 10:46 AM
Yes, the Shared property could also be the problem.
Components having the SHAREDFILE option consider all files to be shared files, and therefore increment registry reference counters for all files involved.
InstallShield Developer increments the registry reference counter by one if the file exists in the target directory and it has a reference count greater than 0. If the shared file does not exist in the target directory and it has no reference counter, InstallShield Developer creates the counter and sets it to 1. If the shared file already exists in the target directory but has no reference counter, InstallShield Developer creates the counter and initializes it to 2 as a precaution against accidental removal during uninstallation.
I suggest you check this property for all the components.
Also, you can use the DeleteDir function. This function deletes a subdirectory. Depending on the value you use in the parameter nFlag, you can delete a subdirectory only if it is empty, delete a subdirectory even if it contains files, or delete an entire root directory. Set nFlag with extreme caution. You need to call this function at the end of uninstallation.
For more information on this function and its parameters, please consult Developers help library.
10-23-2003, 10:54 PM
OK. I made all my components NOT permanent and NOT shared. This made no difference. However, when I looked closely in the regsitry after uninstalling the product, there were MANY entries remaining related to various components with differnt GUIDs to those specified in my new project. (I took this project over from someone else so is a bit messy!)
I have written script in OnFirustUIBefore to FORCE the deletion of the existing INSTALLDIR, and to delete the keys and values I found in the registry. This way when the MAJOR upgrade starts actually installing, the machine it is installing to should be completely clean.
On the MAJOR upgrade uninstall I have placed an "OnUnistalled" function on the feature with the command DeleteDir(INSTALLDIR, ALLCONTENTS) to completely remove any left over files.
While very ugly, this appears to work and should enable a clean update with our next release.
Thanks to everyone for their help.
10-27-2003, 11:00 PM
I'm trying to resolve a problem with uninstallation for a Basic MSI project and was just wondering if you're using an Installscript or MSI installation?
10-27-2003, 11:11 PM
This was all done with InstallScript. Not sure how to go about fixing the problem with MSI projects. Sorry :(
10-27-2003, 11:13 PM
No worries, Thanks 4 the quick reply! I've found the solution.
The problem I was having was that some of the installed files and folders which were created by my basic MSI installer were not being deleted during uninstallation. I noticed that the things that weren't being uninstalled were the components which were registered in the Windows registry (using the self-register option)(and the folders that contained them).
So I tried changing the shared property to "no" for all the registered components in my install project and removing the entries from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDlls that pointed to my components.
After I did this, I removed all the files and folders (that the uninstallation had not removed) including shortcuts manually and then tested my newly built install and it worked nicely for installation/uninstallation.
Thanks KathyMorey for your useful input to this post.
04-19-2005, 06:15 AM
I wanted to say thanks to user mjmcmahon .
I too was having problems with my uninstall as it didn't remove all the files from the install even though I had the properties set to NO for permanent and shared. So I followed your advice to remove the registered components in :
Then deleted any remaining directories that the install did not remove and hey presto...it worked. Thanks so much. Without knowing it, this has plagued me for ages and I put it down to a dodgy computer. Previously I had to uninstall, manually delete files and run regedit. Very time consuming and unnecessary.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.