WiX 3.8 CAQuietExec和命令字符串



我正在尝试在卸载应用程序时执行自定义操作。这些应该在安静模式下完成。因此,我有一部分代码可以让它工作:

<?xml version="1.0"
      encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <Property Id="APPFOLDER">
            <RegistrySearch Id="PATH"
                    Key="Software[Manufacturer][ProductName]"
                    Root="HKLM"
                    Type="raw"
                    Name="InstallPath" />
        </Property>
        <CustomAction Id="CleanupAppDirCmd"
                      Property="CleanupAppDir"
                      Value='rmdir /s/q "[APPFOLDER]"'
                      Execute="immediate"/>
        <CustomAction Id="CleanupAppDir"
                      BinaryKey="WixCA"
                      DllEntry="CAQuietExec"
                      Execute="deferred"
                      Return="ignore"
                      Impersonate="no"/>
        <InstallExecuteSequence>
            <Custom Action="CleanupAppDirCmd"
                    After="CostFinalize"/>
            <Custom Action="CleanupAppDir"
                    After="RemoveFiles">
                REMOVE="ALL"
            </Custom>
        </InstallExecuteSequence>
    </Fragment>
</Wix>

但什么也没发生。完成卸载后,该目录仍然存在。卸载加载告诉我以下内容:

MSI (s) (F8:20) [16:57:15:778]: Executing op: ActionStart(Name=CleanupAppDir,,) MSI (s) (F8:20) [16:57:15:779]: Executing op: CustomActionSchedule(Action=CleanupAppDir,ActionType=3137,Source=BinaryData,Target=CAQuietExec,CustomActionData=rmdir /s/q "C:Program Files (x86)Company") MSI (s) (F8:20) [16:57:15:780]: Creating MSIHANDLE (111) of type 790536 for thread 6176 MSI (s) (F8:C0) [16:57:15:780]: Invoking remote custom action. DLL: C:WindowsInstallerMSI6D67.tmp, Entrypoint: CAQuietExec MSI (s) (F8:5C) [16:57:15:780]: Generating random cookie. MSI (s) (F8:5C) [16:57:15:782]: Created Custom Action Server with PID 6872 (0x1AD8). MSI (s) (F8:78) [16:57:15:809]: Running as a service. MSI (s) (F8:78) [16:57:15:810]: Hello, I'm your 32bit Elevated custom action server. MSI (s) (F8!4C) [16:57:15:819]: Creating MSIHANDLE (112) of type 790531 for thread 2892 MSI (s) (F8!4C) [16:57:15:820]: Closing MSIHANDLE (112) of type 790531 for thread 2892 MSI (s) (F8!4C) [16:57:15:820]: Creating MSIHANDLE (113) of type 790531 for thread 2892 CAQuietExec: Command string must begin with quoted application name. MSI (s) (F8!4C) [16:57:15:820]: Closing MSIHANDLE (113) of type 790531 for thread 2892 MSI (s) (F8!4C) [16:57:15:820]: Creating MSIHANDLE (114) of type 790531 for thread 2892 CAQuietExec: Error 0x80070057: invalid command line property value MSI (s) (F8!4C) [16:57:15:820]: Closing MSIHANDLE (114) of type 790531 for thread 2892 CAQuietExec: Error 0x80070057: failed to get Command Line

我尝试过对CleanupAppDirCmd的值进行几次更改,但都没有成功。我做错了什么?

rmdir不是一个可以执行的EXE,它是cmd.EXE内部的shell命令。

我建议查看RemoveFolderEx元素(Util扩展)。这将是一个更好的解决方案,包括在安装失败或取消时回滚删除。(非常重要)

相关内容

  • 没有找到相关文章

最新更新