How can I pass an folder path to an custom action ExeCommand

490 views Asked by At

We have the following folder structure in our wix declaration:

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="ProgramFilesFolder" Name="$(var.ProgramFilesFolder)">
        <Directory Id="ManufacturerFolder" Name="$(var.Manufacturer)">
          <Directory Id="APPLICATIONFOLDER" Name="$(var.AppFolderName)">

            // further folders or files

          </Directory>
        </Directory>
    </Directory>
</Directory>

Target: We want to delete the APPLICATIONFOLDER on an uninstall. RemoveFolderEx and RemoveFolder will not work for this task, so we need to use a CustomAction. The CustomAction:

<CustomAction Directory="ManufacturerFolder" ExeCommand='/c rmdir /S /Q "[APPLICATIONFOLDER]"' Id="RemoveAppFolder" Execute="deferred" Impersonate="no" Return="ignore"/>

This custom action deletes nothing. What is the correct declaration?

1

There are 1 answers

1
error505 On

Why Don't you do it like this? It must work on uninstall. For example just place it in component where you have shortcut creation.

<RemoveFolder 
            Id="rem_folder" 
            Directory="APPLICATIONFOLDER" 
            On="uninstall"/>
<RemoveFile Id="rem_files"
            On="uninstall"
            Directory="APPLICATIONFOLDER"
            Name="*.*"/>