简体   繁体   中英

WIX MSI: Uninstall of package is not deleting the installation directory root path

During the installation process selected the directory as C:/Test/ (root path for the installation location) for installing my application. It installed successfully in this location (C:/Test/). Uninstalled this package, it is removed all installed files and subdirectories. But not removed the installed root directory (ie C:/Test). below custom action is using to delete/remove the installation root path and installation files (with subdirectories).

    <InstallExecuteSequence>
        <RemoveExistingProducts Before="InstallInitialize" />
        <Custom Action="ApplicationInstallDir" After="AppSearch">APPINSTALLDIR</Custom>
        <Custom Action="DeleteInstallDir" Before="RemoveFiles" >
            REMOVE="ALL"
        </Custom>
    </InstallExecuteSequence>
<CustomAction Id="DeleteInstallDir" BinaryKey="CommandPrompt"
        ExeCommand="cmd /C pushd &quot;[APPINSTALLDIR]&quot; &amp;&amp; (rd /s /q &quot;[APPINSTALLDIR]&quot; 2>nul &amp; popd)"            Execute="deferred" Return="ignore" HideTarget="no" Impersonate="no" />

Use verbose logging of the uninstallation to find the root of the problem:

msiexec /x SetupProject.msi /L*V log.txt

If you install to a non-default directory, verify that [APPINSTALLDIR] is set correctly on uninstallation. (For me, it was not.)

Note that there might be a better way:

WiX supports recursive removal of files and folders with RemoveFolderEx . An explanation how to use it can be found at hass.de . This removes left over files and deletes all directories including the root installation path. I switched from a custom DLL action to RemoveFolderEx and it worked fine.

Your problem might also be covered by this question

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM