简体   繁体   中英

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

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?

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="*.*"/>

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