Thanks for the quick reply.
I believe that the XmlFile is working except that it is using a value that
is set BEFORE the UI section updates the property.
XmlFile changes the value to 'Default WiX value' which is what the
property 'DataValueProperty' is initial set to. But I want the XmlFile to
change the value to whatever the user enters in the UI. The property
seems to be updated according to the UI screens, but the XmlFile still
uses the old value.
-David
Matthew Janulewicz <[EMAIL PROTECTED]>
04/23/2008 02:37 PM
To
"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>,
"wix-users@lists.sourceforge.net" <wix-users@lists.sourceforge.net>
cc
Subject
RE: [WiX-users] Property replacement issue with WixUIExtension andXmlFile
I would try three things:
1) Your ElementPath has a double slash at the beginning. I believe
this is incorrect. We use XmlFile extensively. As an example, here?s what
one of our nodes looks like:
<util:XmlFile Id="Local_ErrorDir_nostart"
Action="setValue"
ElementPath="/configuration/appSettings/[EMAIL PROTECTED]'ErrorDir'[\]]/@value"
File="
[INSTALLDIR]TransDetailImporterService\TransDetailImportService.exe.config
"
Value="[[TARGET_ENVIRONMENT].ERROR_DIR]" />
The file snippet this is editing looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="ErrorDir" value="\\Encrypt\failed"/>
</appSettings>
</configuration>
2) Check the syntax of the ElementPath from above against yours. You
need the full path and parameter. The syntax is pretty precise in what it
will accept.
3) It?s also possible that your variable (I may have the wrong
terminology here) needs to be public, in other words ALL_CAPS. (not likely
though, but it works for us.)
When all else fails the output log from msiexec usually gives a good
indication of what?s going wrong with XmlFile call:
Msiexec /I foo.msi /l* out.txt
Lastly, I have no idea where I stole this script from, but I found a
JavaScript file online that can validate your ElementPath and point you to
where any typos are. I use this thing almost every time I have to edit a
new xml file with Wix:
------------------ begin code validate_xml_path.js
if (2 > WScript.Arguments.length)
{
WScript.Echo("Must specify both the file and the XSL Path to query.");
WScript.Quit(1);
}
WScript.Echo("Opening File: " + WScript.Arguments(0));
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
xmlDoc.async = false;
xmlDoc.load(WScript.Arguments(0));
if (0 != xmlDoc.parseError.errorCode)
{
var myErr = xmlDoc.parseError;
WScript.Echo("You have error " + myErr.reason);
}
else
{
WScript.Echo("Query: " + WScript.Arguments(1));
WScript.Echo();
// xmlDoc.setProperty("SelectionLanguage", "XPath");
currNode = xmlDoc.selectSingleNode(WScript.Arguments(1));
if (null == currNode)
{
WScript.Echo("Nothing found.");
}
else
{
WScript.Echo(currNode.text);
}
}
------------------ end code
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Wednesday, April 23, 2008 11:16 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] Property replacement issue with WixUIExtension
andXmlFile
I?m having a problem with value replacement in a deployed XML file.
I have a property defined (?DataValueProperty?) and I allow the user to
modify it in a dialog in the UI. The next dialog shows the successfully
modified value. But when I go to write the value via XmlFile, the
deployed XML file does not get updated.
What happens is the XmlFile custom action updates the xml file with the
old property value. The new property value set by the Edit control is
being ignored.
I am using version 3.0.4014.0 and I have searched the bug database but
have not found anything relevant to what I am seeing.
Here is the property I'm modifying:
<Property Id="DataValueProperty" Value="Default WiX value" />
Here is the component code:
<Component Id="data" Guid="C685777C-5FED-4593-9B9D-9EED1DDECF8E">
<File Id="data" Source="data.xml" />
<util:XmlFile Id="modifyData" Action="setValue"
File="[INSTALLLOCATION]data.xml"
ElementPath="//dataFile/data"
Name="value"
Value="[DataValueProperty]"/>
</Component>
Here is the UI code, I am adding a custom dialog to the WixUIExtension UI:
<Dialog Id="CustomDlg" Width="370" Height="270" Title="[ProductName]
[Setup]" NoMinimize="yes">
<Control Id="PropertyL" Type="Text" X="45" Y="140" Width="200"
Height="10" TabSkip="no" Text="Change DataValueProperty:" />
<Control Id="PropertyText" Type="Edit" X="45" Y="155" Width="220"
Height="15" Property="DataValueProperty" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56"
Height="17" Text="&Back"></Control>
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56"
Height="17" Default="yes" Text="&Next">
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56"
Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370"
Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="280"
Height="15" Transparent="yes" NoPrefix="yes">
<Text>Please change value for DataValueProperty</Text>
</Control>
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370"
Height="0" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200"
Height="15" Transparent="yes" NoPrefix="yes">
<Text>{\WixUI_Font_Title}Change property</Text>
</Control>
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370"
Height="0"/>
</Dialog>
I can send an example solution if anyone wants to take a look.
Are WixUIExtension and WixUtilExtension compatiable to work in this way?
-David
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users