At a high level I have 2 questions:
1. How do you get XmlConfig to run *after* the config file is installed?
2. To change an existing element without a unique id, do I have to delete it
and recreate it?

So, I'm dealing with an XML config file that should look like this:
<configuration>
        <OnlineStorage>
                <Servers>
                        <clear/>
                        <add url="http://localhost/debug"; username=""
password=""/>
                </Servers>
        </OnlineStorage>
</configuration>


1. I put my XmlConfig entries as children to the Component element that also
has the File element of the configuration file itself. When looking at the
install log, the custom action SchedXmlConfig happens before the files are
copied. Of course, I need to have the xml file put into place before I can
configure it.

My wix file looks something like this:
<Component Id="ProgramEXECONFIG" Guid="*">
        <File Id="ProgramEXECONFIG" Name="Program.exe.config" KeyPath="yes"
Source="$(var.SourceFolder)Program.exe.config" />
        <util:XmlConfig
                Id="XmlConfigServersDelete"
                File="[INSTALLLOCATION]Program.exe.config"
                PreserveModifiedDate="yes"
                Action="delete"
                Node="element"
                ElementPath="//configuration/OnlineStorage"
                VerifyPath="Servers"
                Sequence="1"
                        />
        <util:XmlConfig
                Id="XmlConfigServersCreate"
                File="[INSTALLLOCATION]Program.exe.config"
                PreserveModifiedDate="yes"
                Action="create"
                Node="element"
                ElementPath="//configuration/OnlineStorage"
                Name="Servers"
                Sequence="2"
                        />
        <util:XmlConfig
                Id="XmlConfigClear"
                File="[INSTALLLOCATION]Program.exe.config"
                PreserveModifiedDate="yes"
                Action="create"
                Node="element"
                ElementPath="XmlConfigServersCreate"
                Name="clear"
                Sequence="3"
                        />
        <util:XmlConfig
                Id="XmlConfigAdd"
                File="[INSTALLLOCATION]Program.exe.config"
                PreserveModifiedDate="yes"
                Action="create"
                Node="element"
                ElementPath="XmlConfigServersCreate"
                Name="add"
                Sequence="4"
                />
        <util:XmlConfig
                Id="XmlConfigAddUrl"
                File="[INSTALLLOCATION]Program.exe.config"
                PreserveModifiedDate="yes"
                ElementPath="XmlConfigAdd"
                Name="url"
                Value="[WEBSERVICEURL]"
                Sequence="5"
                        />
        <util:XmlConfig
                Id="XmlConfigAddUserName"
                File="[INSTALLLOCATION]Program.exe.config"
                PreserveModifiedDate="yes"
                ElementPath="XmlConfigAdd"
                Name="username"
                Sequence="6"
                        />
        <util:XmlConfig
                Id="XmlConfigAddPassword"
                File="[INSTALLLOCATION]Program.exe.config"
                PreserveModifiedDate="yes"
                ElementPath="XmlConfigAdd"
                Name="password"
                Sequence="7"
                        />
</Component>

2. My second question is do I really need those 7 XmlConfig operations? All
I want to do is change the attribute url. 

The thing is the config file that gets packaged up is already complete but
has a debug value specified. I want the installer to set the value the user
specifies on install. However, the <add /> element doesn't have an ID so how
can I reference it so I just change that one attribute
(//configuration/OnlineStorage/Servers/a...@url]).


Any help would be much appreciated, sorry for the long code samples but I
wanted to be complete.

--Peter


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to