简体   繁体   English

如何使用 Wix 安装程序删除文件夹和子文件夹?

[英]How can I remove folder and sub folder using Wix installer?

I want add some extension after installation, so tried to add custom action for adding extension in using Wix but now I want remove the folder when performing uninstall action extension folder is not getting removed.我想在安装后添加一些扩展,因此尝试添加自定义操作以使用 Wix 添加扩展,但现在我想在执行卸载操作时删除文件夹扩展文件夹没有被删除。

<Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
            <Component Id="TargetProgram" Guid="f757ff43-0266-483a-8749-ec796cba4b25" >
                <File Id="EXE" Source="C:\Windows\System32\cmd.exe" />
            </Component>
        </ComponentGroup>
        <CustomAction Id="SetTARGETDIR"
                      Directory="TARGETDIR"
                      Value="Pathtoextensionadd"
                      Return="check" />
        <InstallExecuteSequence>
            <Custom Action="SetTARGETDIR" Before="InstallFinalize">Installed </Custom>
        </InstallExecuteSequence>
        <CustomAction Id='EXECUTE_AFTER_FINALIZE' 
                      Directory='TARGETDIR'  
                      Impersonate='yes' 
                      Execute='deferred'
                      ExeCommand='command line argument that install extension in "Pathtoextensionadd"' Return='check' />
        <InstallExecuteSequence>
            <Custom Action="EXECUTE_AFTER_FINALIZE" Before="InstallFinalize">NOT Installed</Custom>
        </InstallExecuteSequence>

Installation is done correctly.安装正确完成。
How can I remove that "Pathtoextensionadd" folder?如何删除该“Pathtoextensionadd”文件夹?

<?define AppCacheFolder ="Pathtoextensionadd" ?>
    <Fragment>
        <DirectoryRef Id="TARGETDIR">
            <Component Id="CacheCleanup" Guid="">
                <RegistryValue Root="HKCU"
                               Key="$(var.AppRegKey)"
                               Name="CachePath"
                               Type="string"
                               Value="$(var.AppCacheFolder)"
                               KeyPath="yes" />
                <util:RemoveFolderEx On="uninstall" Property="CACHEFOLDER" />
            </Component>
        </DirectoryRef>
    </Fragment>

below code added under Product Tag以下代码添加在产品标签下

<?define AppRegKey ="RegPath"  ?>
        <Property Id="CACHEFOLDER">
            <RegistrySearch Key="$(var.AppRegKey)" 
                            Root="HKCU" 
                            Type="raw"
                            Id="CacheFolderRegSearch" 
                            Name="CachePath" />
        </Property>

under feature tag在功能标签下

<ComponentRef Id="CacheCleanup" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我如何使用wix在单个msi中组合框架和安装程序 - how can i combined the framework and installer in single msi using wix 如何使用高级安装程序将 fonts 添加到 windows fonts 文件夹? - How can i add fonts to windows fonts folder using advanced installer? Wix 安装程序 - 基于属性创建文件夹层次结构 - Wix Installer - Create Folder hierarchy based on Property 使用 WIX 安装程序在 C:\\ProgramData 中创建文件夹并在该文件夹中部署几个配置文件 - Create folder inside C:\ProgramData using WIX installer and deploy few configuration files in that folder 如何使用标准WiX创建简化的安装程序体验? - How can I use standard WiX to create a streamlined installer experience? 如何使用 Wix# 将构建文件夹的所有内容添加到安装中? - How to add all contents of build folder to installation using Wix#? 如何使用wix安装程序添加公司名称 - How to add company name using wix installer 如何在WIX中授予INSTALLDIR文件夹权限? - How to give INSTALLDIR folder permission in WIX? 如何在Windows Installer中更改自定义文件夹的路径? - How to change the path of custom folder in windows installer? Wix-Installer-如何获取setup.exe的当前目录? - Wix-Installer-How can I get setup.exe's current directory?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM