【发布时间】:2019-11-19 17:23:12
【问题描述】:
我想让安装程序/卸载程序删除包含应用程序在运行时生成的内容的文件夹。我认为自定义操作是可行的方法。
我们使用的是 WiX 3.6。
(出于对这个问题不重要的特定原因,我希望它出现在安装程序序列中。)
这是我在 xml 中的 CustomAction 定义:
<Binary Id="CustomActionLib" SourceFile="$(var.CustomActionLibrary.TargetDir)$(var.CustomActionLibrary.TargetName).CA.dll" />
<CustomAction Id="DeleteLocalizedCA" Impersonate="yes" BinaryKey="CustomActionLib" DllEntry="DeleteLocalized" Return="check" />
<CustomAction Id="DeleteResourcesCA" Impersonate="yes" BinaryKey="CustomActionLib" DllEntry="DeleteResources" Return="check" />
这是我对他们的引用:
<InstallExecuteSequence>
<Custom Action="DeleteLocalizedCA" Before="InstallFiles"/>
<FindRelatedProducts Before="LaunchConditions" />
<RemoveExistingProducts After="InstallFinalize" />
<RemoveShortcuts>Installed AND NOT UPGRADINGPRODUCTCODE</RemoveShortcuts>
</InstallExecuteSequence>
<InstallUISequence>
<Custom Action="DeleteLocalizedCA" Before="InstallFiles"/>
<FindRelatedProducts Before="LaunchConditions" />
</InstallUISequence>
我将 CustomActionLibrary 项目添加到解决方案中,并从安装程序项目中添加了对其的引用,但它从未运行,我从未在日志中看到它,什么都没有!
因此我的问题是,为什么我的 WiX 自定义操作不运行?
【问题讨论】:
-
先看看这个,看看它是否满足你的需求。在没有彻底了解 MSI 的情况下编写自定义操作可能很危险。 wixtoolset.org/documentation/manual/v3/xsd/util/…
-
@ChristopherPainter - 注意,在提交“DeleteResorucesCA”之前进行更多测试后,它不起作用并且实际上阻止了卸载,但没有升级(由于自定义操作 dll 在完全卸载期间不可用)所以它没有太大的困难是可以恢复的。当我再次访问安装程序时,我会尝试一下。目前,“DeleteLocalizedCA”正在做的正是我想要的。
标签: wix windows-installer custom-action wix3.6