我想在执行应用程序时执行自定义操作。这些应该在安静模式下完成。因此,我有这部分代码,使其工作: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:\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
值几个变化,但毫无效果。我做错了什么?
是的,使用类似MSI的shell命令是一种反模式,除非在适当的错误和异常处理中正确嵌入编码自定义动作 - 即使如此,如果有替代方案,我也不会使用它。绝对使用Util扩展。 – 2014-09-02 17:26:55
非常感谢您的回答。 'RemoveFolderEx'元素的位置有点棘手(作为'component'的子元素),但它完全解决了我的问题。 – frankenpfalzer 2014-09-03 09:14:39