繁体   English   中英

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

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

我想在安装后添加一些扩展,因此尝试添加自定义操作以使用 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>

安装正确完成。
如何删除该“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>

以下代码添加在产品标签下

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

在功能标签下

<ComponentRef Id="CacheCleanup" />

暂无
暂无

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

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