Question

In my wix installer I have a component that just adds a wcf binding to a web.config. Now when the base product is installed with different wcf services enabled my installer won't add it's binding information to the web.config.

I am pretty sure it is because there is already a wsHttpBinding element for the other service in the web.config.

So my question is can I use any path in my VerifyPath? Like instead of checking if that root element exists could I check if a nested element under it has the name I am looking for?

Below is my XmlConfig statements for reference:

                <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" />
Was it helpful?

Solution

Basically VerifyPath uses XPATH queries, so if you write the proper query to select the attribute you should be able to compare it or check

TO select an entry "service1binding" within web.config, we would use the following XPATH query

<wsHttpBinding>
 <binding name="service1binding">

XPATH query

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

THE ABOVE XPATH query is not formatted for WIX and you cannot use it the way it is

Note that the VERIFYPATH is a formatted field and therefore, square brackets in the XPath must be escaped. In addition, XPaths allow backslashes to be used to escape characters, so if you intend to include literal backslashes, you must escape them as well by doubling them in this attribute. The string is formatted by MSI first, and the result is consumed as the XPath.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top