[wix-users] Creating a simple XML while installation.

Kaveesh Dashora kaveeshd at googlemail.com
Mon Sep 12 06:44:09 PDT 2016


Okay... I am deploying a basic empty XML which has the following at the
appdata location

<?xml version="1.0" encoding="utf-8"?>
<Options Version="1.0">
</Options>

Then using the following code to add elements to the XML.

<util:XmlFile Id='XmlSettings3' File='C:\temp\Settings.xml' Permanent ='no'
                  Action='createElement'
Name='ToolInstallationOptionSelected' ElementPath='//Options'
Sequence='1' />
                <util:XmlFile Id='XmlSettings2'
File='C:\temp\Settings.xml' Permanent='no'
                  Action='setValue' Name='Value' Value='Yes'
ElementPath='//Options/ToolInstallationOptionSelected' Sequence='2' />


This works fine... However, I am unable to figure out how do I give
the appdata relative path at the File tag in the XMLFile.


Regards,

Kaveesh



On Fri, Sep 9, 2016 at 9:58 PM, Jon Earle <earlej at hotmail.com> wrote:

> Not quite what you are asking, but may shed some light.
>
> We distribute a small XML file and need to modify it at install time.  The
> following code does that for us:
>
>                 <Component Id="agent_settings" Guid="GUID"
> SharedDllRefCount="yes" Win64="$(var.Win64)">
>                     <File Id="service.xml" Name="service.xml" Vital="no"
> DiskId="1" Source="\path\to\service.xml" />
>
>                     <util:XmlFile Id='SNMPXMLSettings1'
> File='[SNMP]service.xml'  Sequence='1'
>                         Action='setValue' ElementPath='//service/executable'
> Value='[SNMP]snmp.exe' />
>                     <util:XmlFile Id='SNMPXMLSettings2'
> File='[SNMP]service.xml'  Sequence='2'
>                         Action='setValue' ElementPath='//service/logpath'
> Value='[SNMPLOGS]' />
>                     <util:XmlFile Id='SNMPXMLSettings3'
> File='[SNMP]service.xml'  Sequence='3'
>                         Action='setValue' ElementPath='//service/env[\[]@name="ConfigurationPath"[\]]'
> Name='value' Value='[INSTALLDIR]' />
>                 </Component>
>
> Specifies the xml file component and some actions to take when it is
> included in a feature. The intellisense help for the Action attribute also
> includes 'createValue', so you could use a bunch of <util:XmlFile
> Action='createValue' ... >, with the correct xpath values, to create your
> xml file (we do something similar for a couple of INI files).
>
> Cheers!
> Jon
>
> > From: kaveeshd at googlemail.com
> > Date: Fri, 9 Sep 2016 20:33:59 +0530
> > To: wix-users at lists.wixtoolset.org
> > Subject: [wix-users] Creating a simple XML while installation.
> >
> > Hi Guys,
> >
> > I'm trying out to create a simple xml which has the following structure
> > while the installation. This xml should automatically be deleted when the
> > user uninstalls the product. The xml will get created at the appdata
> > location.
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <Options Version="1.0">
> >   <ToolInstallationOptionSelected Value="Yes" />
> > </Options>
> >
> > I am unable to find a solution for this, has anyone any idea for this?
> >
> > Regards,
> > Kaveesh
> >
> > ____________________________________________________________________
> > WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>


More information about the wix-users mailing list