Wix XmlConfig VerifyPath行为

时间:2014-02-06 17:33:38

标签: wix wix3.7

在我的wix安装程序中,我有一个组件,它只是为web.config添加了一个wcf绑定。现在,当基本产品安装时启用了不同的wcf服务,我的安装程序将不会将其绑定信息添加到web.config。

我很确定这是因为web.config中的其他服务已经有一个wsHttpBinding元素。

所以我的问题是我可以在VerifyPath中使用任何路径吗?喜欢而不是检查是否存在根元素,我可以检查其下的嵌套元素是否具有我要查找的名称?

以下是我的XmlConfig语句供参考:

                <util:XmlConfig Id="EndPointIP_wsHttpBinding" Action="create" On="install" Node="element" Name="wsHttpBinding" ElementPath="/configuration/system.serviceModel/bindings" File="[Web]web.config" VerifyPath="/configuration/system.serviceModel/bindings/wsHttpBinding" Sequence="1" />
            <util:XmlConfig Id="EndPointIP_wsHttpBinding_binding" Action="create" On="install" Node="element" Name="binding" ElementPath="/configuration/system.serviceModel/bindings/wsHttpBinding" File="[Web]web.config" VerifyPath="/configuration/system.serviceModel/bindings/wsHttpBinding/binding" Sequence="2" />
            <util:XmlConfig Id="EndPointIP_wsHttpBinding_binding_name" ElementId="EndPointIP_wsHttpBinding_binding" Name="name" Value="wsHTTPBindingConfig" File="[Web]web.config" Sequence="3" />
            <util:XmlConfig Id="EndPointIP_wsHttpBinding_binding_closeTimeout" ElementId="EndPointIP_wsHttpBinding_binding" Name="closeTimeout" Value="00:10:00" File="[Web]web.config" Sequence="4" />
            <util:XmlConfig Id="EndPointIP_wsHttpBinding_binding_openTimeout" ElementId="EndPointIP_wsHttpBinding_binding" Name="openTimeout" Value="00:10:00" File="[Web]web.config" Sequence="5" />
            <util:XmlConfig Id="EndPointIP_wsHttpBinding_binding_receiveTimeout" ElementId="EndPointIP_wsHttpBinding_binding" Name="receiveTimeout" Value="00:10:00" File="[Web]web.config" Sequence="6" />
            <util:XmlConfig Id="EndPointIP_wsHttpBinding_binding_sendTimeout" ElementId="EndPointIP_wsHttpBinding_binding" Name="sendTimeout" Value="00:10:00" File="[Web]web.config" Sequence="7" />
            <util:XmlConfig Id="EndPointIP_wsHttpBinding_binding_maxBufferPoolSize" ElementId="EndPointIP_wsHttpBinding_binding" Name="maxBufferPoolSize" Value="524288" File="[Web]web.config" Sequence="8" />
            <util:XmlConfig Id="EndPointIP_wsHttpBinding_binding_maxReceivedMessageSize" ElementId="EndPointIP_wsHttpBinding_binding" Name="maxReceivedMessageSize" Value="2147483647" File="[Web]web.config" Sequence="9" />
            <util:XmlConfig Id="EndPointIP_wsHttpBinding_binding_readerQuotas" Action="create" On="install" Node="element" Name="readerQuotas" ElementPath="/configuration/system.serviceModel/bindings/wsHttpBinding/binding" File="[Web]web.config" VerifyPath="/configuration/system.serviceModel/bindings/wsHttpBinding/binding/readerQuotas" Sequence="10" />
            <util:XmlConfig Id="EndPointIP_wsHttpBinding_binding_readerQuotas_maxDepth" ElementId="EndPointIP_wsHttpBinding_binding_readerQuotas" Name="maxDepth" Value="32" File="[Web]web.config" Sequence="11" />
            <util:XmlConfig Id="EndPointIP_wsHttpBinding_binding_readerQuotas_maxStringContentLength" ElementId="EndPointIP_wsHttpBinding_binding_readerQuotas" Name="maxStringContentLength" Value="2147483647" File="[Web]web.config" Sequence="12" />
            <util:XmlConfig Id="EndPointIP_wsHttpBinding_binding_readerQuotas_maxArrayLength" ElementId="EndPointIP_wsHttpBinding_binding_readerQuotas" Name="maxArrayLength" Value="2147483647" File="[Web]web.config" Sequence="13" />
            <util:XmlConfig Id="EndPointIP_wsHttpBinding_binding_readerQuotas_maxBytesPerRead" ElementId="EndPointIP_wsHttpBinding_binding_readerQuotas" Name="maxBytesPerRead" Value="4096" File="[Web]web.config" Sequence="14" />
            <util:XmlConfig Id="EndPointIP_wsHttpBinding_binding_readerQuotas_maxNameTableCharCount" ElementId="EndPointIP_wsHttpBinding_binding_readerQuotas" Name="maxNameTableCharCount" Value="16384" File="[Web]web.config" Sequence="15" />
            <util:XmlConfig Id="EndPointIP_wsHttpBinding_binding_security" Action="create" On="install" Node="element" Name="security" ElementPath="/configuration/system.serviceModel/bindings/wsHttpBinding/binding" File="[Web]web.config" VerifyPath="/configuration/system.serviceModel/bindings/wsHttpBinding/binding/security" Sequence="16" />
            <util:XmlConfig Id="EndPointIP_wsHttpBinding_binding_security_mode" ElementId="EndPointIP_wsHttpBinding_binding_security" Name="mode" Value="None" File="[Web]web.config" Sequence="17" />
            <util:XmlConfig Id="EndPointIP_wsHttpBinding_binding_security_transport" Action="create" On="install" Node="element" Name="transport" ElementPath="/configuration/system.serviceModel/bindings/wsHttpBinding/binding/security" File="[Web]web.config" VerifyPath="/configuration/system.serviceModel/bindings/wsHttpBinding/binding/security/transport" Sequence="18" />
            <util:XmlConfig Id="EndPointIP_transport_clientCredentialType" ElementId="EndPointIP_wsHttpBinding_binding_security_transport" Name="clientCredentialType" Value="None" File="[Web]web.config" Sequence="19" />
            <util:XmlConfig Id="EndPointIP_wsHttpBinding_binding_security_message" Action="create" On="install" Node="element" Name="message" ElementPath="/configuration/system.serviceModel/bindings/wsHttpBinding/binding/security" File="[Web]web.config" VerifyPath="/configuration/system.serviceModel/bindings/wsHttpBinding/binding/security/message" Sequence="20" />
            <util:XmlConfig Id="EndPointIP_security_message_establishSecurityContext" ElementId="EndPointIP_wsHttpBinding_binding_security_message" Name="establishSecurityContext" Value="false" File="[Web]web.config" Sequence="21" />
            <util:XmlConfig Id="EndPointIP_endpoint" Action="create" On="install" Node="element" Name="endpoint" ElementPath="/configuration/system.serviceModel/client" File="[Web]web.config" VerifyPath="/configuration/system.serviceModel/client/endpoint" Sequence="22" />
            <util:XmlConfig Id="EndPointIP_endpoint_address" ElementId="EndPointIP_endpoint" Name="address" Value="[CLAIMSURL]" File="[Web]web.config" Sequence="23" />
            <util:XmlConfig Id="EndPointIP_endpoint_binding" ElementId="EndPointIP_endpoint" Name="binding" Value="wsHttpBinding" File="[Web]web.config" Sequence="24" />
            <util:XmlConfig Id="EndPointIP_endpoint_bindingConfiguration" ElementId="EndPointIP_endpoint" Name="bindingConfiguration" Value="wsHTTPBindingConfig" File="[Web]web.config" Sequence="25" />
            <util:XmlConfig Id="EndPointIP_endpoint_contract" ElementId="EndPointIP_endpoint" Name="contract" Value="LossHistoryService" File="[Web]web.config" Sequence="26" />

1 个答案:

答案 0 :(得分:2)

基本上VerifyPath使用XPATH查询,因此如果您编写正确的查询来选择属性,您应该能够比较它或检查

要在web.config中选择条目“service1binding”,我们将使用以下XPATH查询

<wsHttpBinding>
 <binding name="service1binding">

XPATH查询

<强> "/configuration/system.serviceModel/bindings/wsHttpBinding/binding[@name='service1binding']"

ABOVE XPATH查询未针对WIX格式化,您无法按原样使用

请注意,VERIFYPATH是一个格式化字段,因此必须转义XPath中的方括号。此外,XPath允许使用反斜杠来转义字符,因此如果您打算包含文字反斜杠,则必须通过在此属性中将它们加倍来转义它们。该字符串首先由MSI格式化,结果将作为XPath使用。