我正在使用 WIX 创建应用程序的安装程序。 在卸载应用程序期间,我想在卸载程序删除 DLL 文件所属的文件之前调用 DLL 文件中的函数。我检查了其他相关帖子,例如 this post继续。
我创建了一个CustomAction
,如下所示:
<CustomAction Id="UnRegister"
FileKey="mydll.dll"
DllEntry="cleanup"
Execute="immediate"
Return="ignore"/>
然后是InstallExecuteSequence
标记:
<InstallExecuteSequence>
<Custom Action="UnRegister" After="InstallInitialize">Installed AND NOT UPGRADINGPRODUCTCODE</Custom>
</InstallExecuteSequence>
问题是当我尝试卸载应用程序时,文件首先被删除,然后安装程序调用 DLL 中的 cleanup() 函数。出现错误后,卸载会回滚并失败。
如何配置 WIX 安装程序,使其在卸载时先调用该函数,然后删除文件?
谢谢
最佳答案
谢谢博格丹。根据日志,问题是安装程序试图执行我只想在安装时运行的 CustomAction。为此,我应该将“未安装”添加到应该仅在安装期间运行的自定义操作中。像下面这样:
<Custom Action="Register" Before="InstallFinalize">NOT Installed</Custom>
关于wix - 卸载期间 WIX 中的自定义操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21245173/