WiX XmlConfig:卸载时未删除元素 [英] WiX XmlConfig: Elements not removed on uninstall

查看:22
本文介绍了WiX XmlConfig:卸载时未删除元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在卸载时无法删除我在安装时添加到 XML 文件的元素.这是我的设置:XML 文件在安装前已存在于机器上,安装后无法删除,因为此安装程序用于应用程序的加载项".我确实在安装时向 XML 文件添加了一些元素,但只想在卸载时删除其中的一些元素.

我一直在网上搜索答案,但找不到适合我情况的答案.我试过复制这篇文章的语法:Deleting XML elements in WiX,但是它仍然无法正常工作.但是,在安装时,我确实删除了现有元素,以便在元素已经存在的情况下在安装时进行替换.因此,换句话说,删除元素在安装时有效,但使用完全相同的标签(当然除了 Id attr)它在卸载时不起作用.

这是我的代码:

I'm having difficulty removing on uninstall the elements that I add to an XML file on install. Here's my setup: The XML file already exists on the machine before install and can't be remove after install because this installer is for an "add-in" to an application. I do add some elements to the XML file on install, but only want to remove some of those elements on uninstall.

I've been searching online for answers and can't find any that fit my situation. I've tried copying the syntax of this post: Deleting XML elements in WiX, but it still isn't working. However, on install I do remove the existing elements so as to do a replace on install if the elements already exist. So, in other words, deleting an element works on install, but with the exact same tag (except the Id attr of course) it doesn't work on uninstall.

Here's my code:

<Component Id="C_Component" Guid="GUID-HERE">
    <File Id="MainProductFile" ... />
    <!-- XmlConfigs for installation are here -->
    <util:XmlConfig Id="XMLDEL_binding"
              File="[FILE_DIR_PATH]\File.config"
              Sequence="1"
              On="uninstall"
              Action="delete"
              ElementPath="/configuration/system.serviceModel/bindings/customBinding"
              VerifyPath="/configuration/system.serviceModel/bindings/customBinding/binding[\[]@name='!(wix.binding.name)'[\]]"
              Node="element" />
    <util:XmlConfig Id="XMLDEL_endpoint"
              File="[FILE_DIR_PATH]\File.config"
              Sequence="2"
              On="uninstall"
              Action="delete"
              ElementPath="/configuration/system.serviceModel/client"
              VerifyPath="/configuration/system.serviceModel/client/endpoint[\[]@name='!(wix.endpoint.name)' and @bindingConfiguration='!(wix.endpoint.bindingConfiguration)'[\]]"
              Node="element" />
</Component>

推荐答案

我终于找到了问题所在.我意识到 [FILE_DIR_PATH] 在卸载时没有价值.此属性是通过 RegistrySearch 获得的.所以,我所要做的就是将属性声明为 Secure:

I finally figured out the problem. I realized that [FILE_DIR_PATH] had no value on uninstall. This property was obtained by a RegistrySearch. So, all I had to do to fix it was to declare the property as Secure:

<Property Id="FILE_DIR_PATH" Secure="yes">
    <RegistrySearch ... />
</Property>

我发现这会在尝试使用其他安装程序修复修复问题时解决一些问题.我发现这篇文章很有用:Wix 安装程序在修复时清除注册表设置.

我还发现 Rob Mensching 的一篇博文对此类问题很有用:
http://robmensching.com/blog/posts/2010/5/2/The-WiX-toolsets-Remember-Property-pattern

I found out that this would solve some problems while trying to fix repair issues with another installer. I found this post useful: Wix installer blanks out registry setting when repairing.

I also found a blog post by Rob Mensching useful with issues of this nature: http://robmensching.com/blog/posts/2010/5/2/The-WiX-toolsets-Remember-Property-pattern

这篇关于WiX XmlConfig:卸载时未删除元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆