WiX 3.8 CAQuietExec和命令字符串

时间:2014-09-02 15:21:01

标签: wix windows-installer custom-action wix-extension

我在尝试取消应用程序时尝试执行自定义操作。这些应该在安静模式下完成。因此,我使用了那部分代码来实现它:

<?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>

但没有任何反应。完成卸载后,该目录仍然存在。 uninstall-log告诉我以下内容:

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:\Windows\Installer\MSI6D67.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的值进行多项更改,但没有任何效果。我做错了什么?

1 个答案:

答案 0 :(得分:1)

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

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