mgr
mgr

Reputation: 651

MSI (created from WIX)- Uninstall application is not removing the root installation folder

MSI (created from WIX)- Uninstall application is not removing the root installation folder.

1) I have installed the MSI (example: selected installation root location: C:/MSI_test/ and installed with AppName. And final location is C:/MSI_test/AppName/) and part of the installation copied MSI into my installation location (for repair purpose from uninstall shortcut Key. When I click the uninstall shortcut it points to the MSI in my installed directory and opens a dialog with Repair or Remove option)

2) If the user tries to uninstall this application from the uninstall shortcut, it removes all the installed files and folders but not removing the root installation location (i.e. C:/MSI_test/AppName/).

Below is the code having in my uninstall.bat file (which is called during uninstall shortcut)

cmd.exe /c start "" "C:\MSI_test\AppName\Config\App.msi"
exit;

3) If I have MSI in different location (i.e. in C:/testing) and trying to uninstall the application, it removes everything (i.e. installed files and folders including root installation location)

4) Is this a problem to delete the root folder if we are trying to uninstall from the above step-2 to delete the root installation folder?

Upvotes: 1

Views: 1018

Answers (2)

Kyanar
Kyanar

Reputation: 11

What you're seeing is the result of a lock being placed on that folder or its contents, likely as a result of the batch file itself executing (which sets the working directory of the command interpreter running it to the folder it is in, and places a read lock on the folder).

That said, I'm unsure why you're making a copy of the MSI in the application folder anyway, as the Windows Installer will make a copy itself and place it in %windir%\Installer. When you kick off your uninstall from the shortcut, the installer reads the product code from the MSI you provided it and then goes back to the cached copy anyway.

Ideally, you should do away with the batch file and place a direct shortcut to msiexec.exe /i {product-code} - this will kick off the installation/maintenance UI for your product if it is installed. If you must have a batch file, you will need to place it outside your application's installation root.

Upvotes: 0

PhilDW
PhilDW

Reputation: 20780

The problem you're having is likely to be that your uninstall is holding the folder open. I've solved this problem previously by creating an exe that does the uninstall and copying it to the Temp folder andf running the uninstall program from there, and people generally clean up the temp folder anyway.

This might be a better way of doing it too:

http://robmensching.com/blog/posts/2007/4/27/how-to-create-an-uninstall-shortcut-and-pass-all-the/

Upvotes: 1

Related Questions