WIX XmlConfig 操作未在补丁回滚时运行
我有一个运行几个 XmlConfig 操作的组件:一个在安装时,一个在卸载时:
<Component Id="machine.config.Update" Guid="573DF5B0-438D-498d-8919-C4B96835C1EF">
<RegistryKey Root="HKLM" Key="[REGISTRYKEY]\Settings\[TITLE]" Action="createAndRemoveOnUninstall">
<RegistryValue Action="write" Type="integer" Name="MACHINEMEMORYLIMIT" Value="1" KeyPath="yes"/>
</RegistryKey>
<util:XmlConfig
Id="CacheNode.memoryLimit.add"
File="[WindowsFolder]\Microsoft.NET\[FRAMEWORKDIR]\v2.0.50727\CONFIG\machine.Config"
Action="create"
ElementPath="/configuration/system.web/processModel"
Name="memoryLimit"
Node="value"
On="install"
Value="90" />
<util:XmlConfig
Id="CacheNode.memoryLimit.remove"
File="[WindowsFolder]\Microsoft.NET\[FRAMEWORKDIR]\v2.0.50727\CONFIG\machine.Config"
Action="delete"
ElementPath="/configuration/system.web/processModel"
VerifyPath="/configuration/system.web/processModel"
Name="memoryLimit"
Node="value"
On="uninstall" />
</Component>
该组件是我可以安装和回滚的补丁的一部分。问题是当我卸载补丁时,卸载操作不会触发。奇怪的是,如果我将其更改为 On="install"
,则会执行相同的 XmlConfig 操作。我发现卸载时注册表项已被正确删除。为什么 XmlConfig 操作也没有触发?我检查了日志,没有看到任何错误或解释为什么它没有发生。
更新: XmlConfig 操作在执行完全卸载时起作用。只是不进行补丁回滚。
I've got a component that runs a couple of XmlConfig actions: one on install and one on uninstall:
<Component Id="machine.config.Update" Guid="573DF5B0-438D-498d-8919-C4B96835C1EF">
<RegistryKey Root="HKLM" Key="[REGISTRYKEY]\Settings\[TITLE]" Action="createAndRemoveOnUninstall">
<RegistryValue Action="write" Type="integer" Name="MACHINEMEMORYLIMIT" Value="1" KeyPath="yes"/>
</RegistryKey>
<util:XmlConfig
Id="CacheNode.memoryLimit.add"
File="[WindowsFolder]\Microsoft.NET\[FRAMEWORKDIR]\v2.0.50727\CONFIG\machine.Config"
Action="create"
ElementPath="/configuration/system.web/processModel"
Name="memoryLimit"
Node="value"
On="install"
Value="90" />
<util:XmlConfig
Id="CacheNode.memoryLimit.remove"
File="[WindowsFolder]\Microsoft.NET\[FRAMEWORKDIR]\v2.0.50727\CONFIG\machine.Config"
Action="delete"
ElementPath="/configuration/system.web/processModel"
VerifyPath="/configuration/system.web/processModel"
Name="memoryLimit"
Node="value"
On="uninstall" />
</Component>
The component is part of a patch that I can install and roll back. The problem is that the uninstall action doesn't fire when I uninstall the patch. The odd part is that the same XmlConfig action does execute if I change it to be On="install"
. I see that the registry key is properly removed on uninstall. Why isn't the XmlConfig action firing as well? I checked the logs and did not see any errors or explanation of why it didn't happen.
Update:
The XmlConfig action works when doing a full uninstall. Just not on a patch rollback.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从 wix-users 邮件列表中得到了答案。
罗布·门兴:
“在补丁中添加自定义操作效果不太好。补丁本质上是将转换应用于现有 MSI,然后修复 MSI。在卸载补丁的情况下,转换将被删除并修复 MSI。显然,如果自定义操作操作随转换一起删除,然后
Windows Installer 会使用特殊的魔法来跟踪转换前后 MSI 的状态,以便他们可以正确删除数据。”
他们还谈到了 MSI 4.5 中的一个功能可以让你做到这一点,但 WIX 需要与早期版本保持兼容,并且仍然存在一些数据存储问题。
简而言之,补丁卸载的自定义操作在 WIX 中不起作用。
Got an answer from the wix-users mailing list.
Rob Mensching:
"Adding custom actions in patches doesn't work out so well. Patches essentially apply transform to the existing MSI then repair the MSI. In the case of uninstalling a patch, the transform is removed and the MSI is repaired. Obviously, if the custom action is removed with the transform then it has no chance to run.
The Windows Installer does special magic to keep track of the state of the MSI before and after the transform so they can properly remove data."
They also talked about how there was a feature in MSI 4.5 that may let you do it but WIX needed to stay compatible with earlier versions and there were still some data storage problems around it.
So in short, custom actions on patch uninstall don't work in WIX.
我已经(几乎)按原样验证了您的样本,它工作正常。问题可能出在您的 FRAMEWORKDIR 属性中。确保安装和卸载时均已正确设置。
可能会出现这样的情况:它会回退到卸载流程的默认值,并且属性会被删除,但是是从另一个文件中删除的。
I have verified your sample (almost) as is, at it works fine. The problem can be in your FRAMEWORKDIR property. Make sure it is set on both Install and Uninstall correctly.
It might be the case that it falls back to its default value for Uninstall flow and the attribute is removed, but from another file.