0

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 (i.e. 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" />
mgr
  • 641
  • 1
  • 8
  • 23
  • Windows Installer should be uninstalling this automatically without the need to call a cmd session. There's other problems with your installer. – Christopher Painter Jan 26 '15 at 23:06
  • ..and in addition to Chris's comment, you wouldn't use code either because WiX offers a RemoveFile element. – PhilDW Jan 27 '15 at 01:02

1 Answers1

1

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

Community
  • 1
  • 1
Wolfgang A
  • 11
  • 3
  • hi - can anyone comment if this solution worked? I am having a similar problem and am looking for different solutions... – murtazat May 05 '15 at 06:31
  • It is not worked for me. still the problem is there. And in Windows-Xp m/c it is not removing log files (which are created during the application using). But these log files are deleting during uninstall in case of Windos-7 and Windows-8 – mgr Sep 11 '15 at 15:17