开发者

WIX XmlConfig action not running on patch rollback

开发者 https://www.devze.com 2023-02-05 12:37 出处:网络
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\">

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 comp开发者_开发问答onent 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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号