Monday, June 29, 2009

MSI: Uninstall left some files not removed

I created a MSI package and tested the installation and uninstallation. Everything looked good except for one file. The abc.exe file could not be removed by the uninstallation process. The INSTALLDIR started clean. And file was not used at the time of uninstallation.


I created the extensive log using /L*v option with msiexec command. After studying the log file and comparing the ComponentId in the msi, I found out that the file was marked "PreviouslyPinned".


MSI (s) (50:C0) [15:22:31:932]: Executing op: ComponentUnregister(ComponentId={4CA897DC-C1DD-1A1D-CA93-FF18DA884529},,BinaryType=0,PreviouslyPinned=1)1: {2E9A386D-9B96-4E7C-9AE9-B614A86EEFA5} 2: {4CA897DC-C1DD-1A1D-CA93-FF18DA884529}


Sure enough, I found an entry of the file in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs.

After deleting the entry, the uninstallation of the MSI worked properly. The MSI package was correct, the problem resided on the testing environment.