WixSilentExec 不起作用

WixSilentExec does not work

我必须在卸载时默默地 运行 一些 cmd 行。我正在尝试使用 WixSilentExec,但它不起作用。有什么问题?

    <Property Id="WixSilentExecCmdLine" Value='cmd /C "rmdir /s/q [DataBaseDir]"' Hidden="yes"/>
    <CustomAction Id="RemoveDataDir" BinaryKey="WixCA" DllEntry="WixSilentExec" Execute="immediate" Return="ignore"/>

    <InstallExecuteSequence>
        <Custom Action="RemoveDataDir" Before="RemoveFiles">DELETEDATADIR="1" OR FORCEDELETE="1") AND (NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>
    </InstallExecuteSequence>

    <Directory Id="DataBaseDir" Name="$(var.DataBaseDirName)">
          <Component Id="DataBaseDir.dir" Guid="*">
               <CreateFolder/>
          </Component>
    </Directory>
  1. 无法解析名称 cmd,应使用引用的可执行文件名称代替:"cmd.exe"

  2. 应使用 SetProperty,因为安装程序无法解析 [DataBaseDir]

  3. 顺序execute应设置

    <Property Id="RemoveDataDir" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="immediate" Return="ignore"/>
    <SetProperty Id="WixQuietExecCmdLine" Before="RemoveDataDir" Sequence="execute" Value='"cmd.exe" /c rmdir /s/q "[DataBaseDir]"'>1</SetProperty>