util:XmlFile, conditionally set value

3 messages Options
Embed this post
Permalink
Scott Vickery

util:XmlFile, conditionally set value

Reply Threaded More More options
Print post
Permalink
Any ideas on how to conditionally set a value in an xml?  Based on a global variable, CLIENTNAME, I want to set a value in a web.config.  Something like the following, but, I know it does not work:

      <Condition Level="0"><![CDATA[CLIENTNAME<>SOMECLIENT]]>
       <util:XmlFile Id="UpdateWebConfig"
            File="[ServiceInstanceDirectory]Web.config"
            Action="setValue"
            ElementPath='/configuration/appSettings/add[\[]@key="SomeKey"[\]]'
            Name="value"
            Value="SomeValue"
            />
      </Condition>
Thanks,
Scott
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Alexander Shevchuk (Volt)

Re: util:XmlFile, conditionally set value

Reply Threaded More More options
Print post
Permalink
Hi Scott,

If this condition does not apply to a component which installs Web.config file, put <util:XmlFile> in separate <Component> and apply condition to it:

<Component Id=...>
  <Condition><![CDATA[CLIENTNAME<>SOMECLIENT]]></Condition>
  <util:XmlFile ...
</Component>

Basically, <Condition> is a child of <Component> and does not have children of its own:
http://wix.sourceforge.net/manual-wix2/wix_xsd_component.htm - Component
http://wix.sourceforge.net/manual-wix2/wix_xsd_condition.htm - Condition


Alex


-----Original Message-----
From: Scott Vickery [mailto:[hidden email]]
Sent: Tuesday, October 27, 2009 11:32 AM
To: [hidden email]
Subject: [WiX-users] util:XmlFile, conditionally set value

Any ideas on how to conditionally set a value in an xml?  Based on a global variable, CLIENTNAME, I want to set a value in a web.config.  Something like the following, but, I know it does not work:

      <Condition Level="0"><![CDATA[CLIENTNAME<>SOMECLIENT]]>
       <util:XmlFile Id="UpdateWebConfig"
            File="[ServiceInstanceDirectory]Web.config"
            Action="setValue"
            ElementPath='/configuration/appSettings/add[\[]@key="SomeKey"[\]]'
            Name="value"
            Value="SomeValue"
            />
      </Condition>
Thanks,
Scott
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Blair-2

Re: util:XmlFile, conditionally set value

Reply Threaded More More options
Print post
Permalink
In reply to this post by Scott Vickery
Put it in its own component.

    <Component Id="UpdateWebConfig" Guid="PLACE_GUID_HERE" .../>
      <Condition><![CDATA[CLIENTNAME<>SOMECLIENT]]></Condition>
       <util:XmlFile Id="UpdateWebConfig"
            File="[ServiceInstanceDirectory]Web.config"
            Action="setValue"
 
ElementPath='/configuration/appSettings/add[\[]@key="SomeKey"[\]]'
            Name="value"
            Value="SomeValue"
            />
    </Component>

>From there, mark the component transitive or not as is appropriate, etc.

-----Original Message-----
From: Scott Vickery [mailto:[hidden email]]
Sent: Tuesday, October 27, 2009 11:32 AM
To: [hidden email]
Subject: [WiX-users] util:XmlFile, conditionally set value

Any ideas on how to conditionally set a value in an xml?  Based on a global
variable, CLIENTNAME, I want to set a value in a web.config.  Something like
the following, but, I know it does not work:

      <Condition Level="0"><![CDATA[CLIENTNAME<>SOMECLIENT]]>
       <util:XmlFile Id="UpdateWebConfig"
            File="[ServiceInstanceDirectory]Web.config"
            Action="setValue"
 
ElementPath='/configuration/appSettings/add[\[]@key="SomeKey"[\]]'
            Name="value"
            Value="SomeValue"
            />
      </Condition>
Thanks,
Scott
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users