|
From: James B. <Jam...@tr...> - 2014-05-15 16:58:06
|
Hi Tim,
Please see (much further) below an implementation I use.
It will turn this:
<Configuration>
<Extensions>
<Data>
</Data>
</Extensions>
</Configuration>
Into:
<Configuration>
<Extensions>
<Data>
<Extension Name="ExtName" Type=" SomeValue "/>
</Data>
</Extensions>
</Configuration>
And on uninstall will remove the bits it has created.
Most of the time I do MajorUpgrades, so I control the content in the original config file, which means I can get away with a simple XMLFile command to set the value.
I only use XMLConfig when I'm poking around in files that aren't actually mine as I need to be able to back out my changes on uninstall and XMLFile isn't too good at this.
Anyway, on to the code (names have been changed to protect identities):
<Fragment>
<DirectoryRef Id="INSTALLLOCATION">
<Component Id="DataExtension" Guid="{93217AB4-B61E-4EF0-BC07-ABFBEE569466}" Win64="yes">
<util:XmlConfig Id="DataExtension"
On="install"
Action="create"
Sequence="1"
File="[INSTALLLOCATION] server.config"
ElementPath ="//Configuration/Extensions/Data"
VerifyPath ="//Configuration/Extensions/Data/Extension[\[]@Name= ExtName [\]]"
Node="element"
Name="Extension"
/>
<CreateFolder/>
</Component>
<Component Id="DataExtensionName" Guid="{64DE6042-74C9-4F04-9BBD-C40E9D5742E6}" Win64="yes">
<util:XmlConfig Id="DataExtensionName"
Sequence="2"
File="[INSTALLLOCATION] server.config"
ElementId ="DataExtension"
VerifyPath ="//Configuration/Extensions/Data/Extension[\[]@Name= ExtName [\]]"
Name="Name"
Value=" ExtName"
/>
<CreateFolder/>
</Component>
<Component Id="DataExtensionType" Guid="{250572F0-1F0A-4FED-B56C-D6654EFBA193}" Win64="yes">
<util:XmlConfig Id="DataExtensionType"
Sequence="3"
File="[INSTALLLOCATION]server.config"
ElementId ="DataExtension"
VerifyPath ="//Configuration/Extensions/Data/Extension[\[]@Name= ExtName [\]]"
Name="Type"
Value="SomeValue"
/>
<CreateFolder/>
</Component>
<!--Uninstall-->
<Component Id="DataExtensionUninstall" Guid="{DB19543E-F691-4452-B0B5-04F6D1F43BF2}" Win64="yes">
<util:XmlConfig
Id="DataExtensionUninstall"
File="[INSTALLLOCATION] server.config"
Action="delete"
Node="element"
VerifyPath="Extension[\[]@Name= ExtName [\]]"
ElementPath="//Configuration/Extensions/Data"
On="uninstall"
Sequence="1" />
<CreateFolder/>
</Component>
</DirectoryRef>
</Fragment>
Before you implement this, please understand what it does and (most importantly) what you are trying to achieve.
James
|