我有包含下一个内容的XML文件:
<!--<appcache appCacheType="None" />-->
<appcache appCacheType="SingleClient" defaultExpiration="3600"/>在安装修补程序时,我需要将XML文件中的内容更改为:
<appcache appCacheType="None" />
<!--<appcache appCacheType="SingleClient" defaultExpiration="3600"/>-->有什么更好的方法去做呢?
谢谢。
发布于 2014-04-01 07:37:53
为了这个目的,我试图(徒劳无功)使用MSI社区扩展,但没能让它们启动并运行。最后,我使用了Util扩展中的util:XmlFile-tag,它运行得完美无缺。
Wix-element中向源文件添加Util-扩展名的命名空间:
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension“ElementPath-attribute中的-attribute调整为与您的标记匹配的appcache-tag (在示例中它更新了带有值SingleClient的属性appCacheType的appcache-tag)和XML-文件的文件键:<Component Id="myComponentToUpdateTheXmlFile" ... >
<!-- Removing the defaultExpiration-attribute first -->
<util:XmlFile Id="UpdateAppCacheTag" Action="deleteValue" ElementPath="//appcache[\[]@appCacheType='SingleClient'[\]]/@defaultExpiration" File="[#MyConfigFile.xml]" SelectionLanguage="XPath" Sequence="1" Name="defaultExpiration" />
<!-- Now updating the value -->
<util:XmlFile Id="UpdateAppCacheTag" Action="setValue" ElementPath="//appcache[\[]@appCacheType='SingleClient'[\]]/@appCacheType" File="[#MyConfigFile.xml]" SelectionLanguage="XPath" Sequence="2" Value="None" />
</Component>如果您只想在例如修补过程中这样做,那么为这个组件添加适当的条件。
https://stackoverflow.com/questions/22759769
复制相似问题