Hi I am trying to change a value setting in a config file using the following:
<Component Id="Enable32BitAppPoolComponent" Guid="*" Directory="INSTALLLOCATION">
<CreateFolder/>
<util:XmlConfig Id="Enable32BitAppPool" Node="value"
ElementPath="//configuration/system.applicationHost/applicationPools/add[\[]@name='DefaultAppPool'[\]]/@enable32BitAppOnWin64"
File="[inetsrv]\config\applicationHost.config"
Value="true" On="install"/>
</Component>
This code does not change the value in the applicationHost.config
file. I tried adding the action="create"
but I then got the error during the setup that it could not open the XML file. What am I doing wrong?
I think it's more convenient to use XmlFile elements to modify attribute values:
<Component Id="Enable32BitAppPoolComponent" Guid="*" Directory="INSTALLLOCATION">
<CreateFolder/>
<util:XmlFile Id="Enable32BitAppPool"
Action="setValue"
Name="enable32BitAppOnWin64"
ElementPath="//configuration/system.applicationHost/applicationPools/add[\[]@name='DefaultAppPool'[\]]"
File="[inetsrv]\config\applicationHost.config"
PreserveModifiedDate="yes"
SelectionLanguage="XPath"
Sequence="INSERTCORRECTSEQUENCENUMBERHERE"
Value="true" />
</Component>
You have to correctly assign the Sequence number in the snippet above.
The Sequence attribute is also missing in your XmlConfig element, so that might be a problem with your code. Another problem is the definition of the ElementPath
attribute. Adding @enable32BitAppOnWin64
to it is wrong. The ElementPath
attribute locates the element you want to change, in your case the add
element which has the name
attribute of DefaultAppPool
. In that element you want to change the value of an attribute. You specify the attribute by its name. For that purpose you have to add the name
attribute to your XmlConfig
element. In combination with the Node
attribute set to value
the attribute definition is complete. The Action
attribute of the XmlConfig element has to be set to create
. The VerifyPath
attribute of the XmlConfig element is used to determine if the Node shall be added or modified.
The correct version of your XmlConfig element should look like this:
<Component Id="Enable32BitAppPoolComponent" Guid="*" Directory="INSTALLLOCATION">
<CreateFolder/>
<util:XmlConfig
Id="Enable32BitAppPool"
Action="create"
Node="value"
ElementPath="//configuration/system.applicationHost/applicationPools/add[\[]@name='DefaultAppPool'[\]]"
File="[inetsrv]\config\applicationHost.config"
Name="enable32BitAppOnWin64"
Value="true"
On="install"/>
</Component>
If your installer tells you it cannot open the XML File, then you have to check if the File
attribute's value is correct. Maybe you need to change it to something like "[INSTALLFOLDER]\config\applicationHost.config"
or whatever you set the Id
attribute of your installation directory to. The installer log should provide you with the information which file could not be opened.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With