This isn't what you want but might help you make a start:

            <util:XmlConfig Id='create.DbInstance' Action='create'
ElementPath='/Settings' VerifyPath='/Settings/DbInstance'
File='[#settings.xml]' Name='DbInstance' Node='element' On='install'
Sequence='1' />
            <util:XmlConfig Id='set.DbInstance' Action='create'
ElementPath='/Settings/DbInstance' File='[#settings.xml]' Node='value'
Value='[DBINSTANCE]' On='install' Sequence='2' />

Basically this will append a <DbInstance> node to the <Settings> node
but only if one doesn't already exist
(VerifyPath='/Settings/DbInstance').
Then it sets the value of the node (either the pre-existing one, or the
newly created one) to [DBINSTANCE].

Might help you see how VerifyPath works... I had to experiment a bit to
figure out the exact behavior I wanted from XmlConfig... presumably
you'll do something like VerifyPath='/path/to/no...@myattribute=""]' or
such like...




-----Original Message-----
From: Matt Siebert [mailto:mlsieb...@gmail.com] 
Sent: 16 December 2010 01:33
To: General discussion for Windows Installer XML toolset.
Subject: [WiX-users] Selectively updating app.config

Hi all,

I need to selectively update an app.config file from my setup package.
 Specifically, I need to set a single attribute if it doesn't exist or
has an empty string value.  If it already has some other value then I
need to leave it unchanged.

What's the preferred way to do this?

I've authored a CA that does this but changes are being redirected to
the VirtualStore.  I've just seen that I can set
CustomAction/@Impersonate="no"
to get around this, but I haven't tested it yet.

I see there is util:XmlConfig and using this it successfully sets the
value, but I can't see how to detect if the attribute is already present
and skip it.  I'm wondering if the VerifyPath attribute would help but I
can't find any decent examples or explanation of how to use it.

Thanks,
Matt.
------------------------------------------------------------------------
------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how to connect the dots, take
your collaborative environment to the next level, and enter the era of
Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to