[ wix-Bugs-1273412 ] XmlFile issue with XPath and attributes

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ wix-Bugs-1273412 ] XmlFile issue with XPath and attributes

SourceForge.net
Bugs item #1273412, was opened at 2005-08-25 16:21
Message generated for change (Comment added) made by mikeheyda
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=642714&aid=1273412&group_id=105970

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: CustomActions
Group: v2.0
Status: Open
Resolution: None
Priority: 5
Submitted By: Steve Norman (nogsoft)
Assigned to: Scott Kurtzeborn (scotk)
Summary: XmlFile issue with XPath and attributes

Initial Comment:
I'm trying to use the XmlFile element to change the
settings in a web.config file installed by the MSI.   I can
get the XmlFile to change one of the attributes but not
another.

Sample XML file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
    <compilation defaultLanguage="c#" debug="true" />
  </system.web>
  <DirectoryServices>
    <default>
      <add key="TFDirectory.AdminUserContainer"
value="CN=Users" />
    </default>
  </DirectoryServices>
</configuration>

This works and sets the debug attribute of
<compilation /> to true:

<XmlFile
  Id="Conf_TFAdminCommanName"
  CreateElement="no"
 
ElementPath="/configuration/system.web/compilation/@
debug"
  File="[TSAWSWEBDIR]Web.config"
  Value="false" />

This throws an error:

<XmlFile
  Id="Conf_TFAdminCont"
  CreateElement="no"
 
ElementPath="/configuration/DirectoryServices/default/ad
d\[@key='TFDirectory.AdminUserContainer'\]/@value"
  File="[TSAWSWEBDIR]Web.config"
  Value="CN=Admin Users" />


The logfile shows the following error:

ExecXmlFile:  CustomActionData: 1?F:\web\Thomson
Financial\TSAWS\Web.config?2?/configuration/Directory
Services/default/add\[@key='TFDirectory.AdminUserCont
ainer'\]/@value??CN=Admin Users
ExecXmlFile:  Error 0x80004005: failed to find
node: /configuration/DirectoryServices/default/add\[@key
='TFDirectory.AdminUserContainer'\]/@value in XML file:
F:\web\Thomson Financial\TSAWS\Web.config
Action ended 16:31:17: InstallFinalize. Return value 3.
Action ended 16:31:30: INSTALL. Return value 3.

I have tried using both escaped and non-escaped ['s in
the ElementPath but both fail.  A similar Xpath works in
a vbscript custom action (which I'm trying to move away
from.

Also, no errors get reported by this in the eventlog.  Is
there something I need to do to get them reported (we
install our MSI's remotely using WMI so don't get any
visual clue's as to what went wrong).


----------------------------------------------------------------------

Comment By: Mike (mikeheyda)
Date: 2005-09-26 20:13

Message:
Logged In: YES
user_id=1352264

I had this same problem and was finally able to track it
down.  It's not a Wix issue but is a formatted string issue.  
The wix documentation states only that a backslash can be
used to encode a square bracket.  According to the MSI
documentation page (url below) I found you need to enclose
the \[ in square brackets.  You example would actually
be /configuration/DirectoryServices/default/add[\[]
@key='TFDirectory.AdminUserContainer'[\]]/@value.  This
solution worked for me.

http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/msi/setup/formatted.asp


----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=642714&aid=1273412&group_id=105970


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
WiX-devs mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-devs