删除 WiX 中的 XML 元素 [英] Deleting XML elements in WiX
问题描述
如何从 WiX 中的 XML 文件中删除/移除元素?
给定一个包含以下内容的 .config 文件:
<预><代码><配置><东西><东西><item type='value'/><item type='value2'/></东西></东西></配置>要删除 type 属性设置为 'value' 的 item 元素,这似乎可以解决问题:
此 XmlConfig
元素由 WixUtility"扩展定义.要使用该扩展,您必须像这样声明 UtilExtension 命名空间:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
您还必须将 -ext WixUtilExtension
添加到 light.exe
命令选项,或者如果您正在创作 wix 项目,则添加对WixUtilExtension.dll"的引用在 Visual Studio 中使用 Votive.
How do you delete/remove an element from an XML file in WiX?
Given a .config file with the following content:
<configuration>
<thingy>
<stuff>
<item type='value' />
<item type='value2' />
</stuff>
</thingy>
</configuration>
To remove the item element with the type attribute set to 'value' this seems to do the trick:
<util:XmlConfig
On="install"
Action="delete"
Id="RemoveAnElement"
Node="element"
File="Application.dll.config"
VerifyPath="/configuration/thingy/stuff/item[\[]@type='value'[\]]"
ElementPath="/configuration/thingy/stuff"
Sequence="100"
/>
This XmlConfig
element is defined by the Wix "Utility" extension. To use that extension, you have to declare the UtilExtension namespace like this:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
You also have to add -ext WixUtilExtension
to the light.exe
command options, or add a reference to "WixUtilExtension.dll" if you are authoring a wix project using votive in visual studio.
这篇关于删除 WiX 中的 XML 元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!