XPath for web.config applicationSettings webdeploy parameters.xml file is not correct

1.9k views Asked by At

I use webdeploy to deploy my web site project with a parameters.xml file I have been using a for a while. So far the parameters I've added are all element attributes and it all works well. But I am trying to get the xpath right to update an applicationSettings element value (not attributes) and am failing, badly, to work out if its my poor xpath skills to blame or a misunderstanding of the way the parameters file works.

When I do a deployment the field is not updated, it compiles fine and no errors\warnings during deployment. I want to be able to set this to True or False.

So I have following parameters field

<parameter name="ShowExceptionCallStackOnErrorView" description="Display a call stack on the UI Error view - true for debug only." defaultValue="False" tags="">
    <parameterEntry kind="XmlFile" scope="\\web.config$" match="/configuration/applicationSettings/abc.123.Properties.Settings/setting[@name='ShowExceptionCallStackOnErrorView']/value" />
</parameter>

trying to match to the following application settings section

<configuration>
    <applicationSettings>
        <abc.123.Properties.Settings>
            <setting name="ShowExceptionCallStackOnErrorView" serializeAs="String">
               <value>True</value>

Any help would be much appreciated!

1

There are 1 answers

2
Ben Ripley On

It's not giving you an error because it is simply not finding a match to replace. You need to add /text() to the end of your match tag if you want it to replace the contents of the value tag. As follows...

<parameter name="ShowExceptionCallStackOnErrorView" description="Display a call stack on the UI Error view - true for debug only." defaultValue="False" tags="">
  <parameterEntry kind="XmlFile" scope="\\web.config$" match="/configuration/applicationSettings/abc.123.Properties.Settings/setting[@name='ShowExceptionCallStackOnErrorView']/value/text()" />
</parameter>