I am lost. I've got a Web project that comes with a config file and several parameters which need to be set differently per target environment. I have an app setting and a connection string. The DEFINE
values need to be replaced.
Web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="HostUri" value="DEFINE"/>
...
</appSettings>
<connectionStrings>
<add name="DbConn" connectionString="DEFINE" providerName="System.Data.SqlClient"/>
</connectionStrings>
...
</configuration>
I've got a parameter specification which an Azure App Service Deploy task uses later during deployment. Here, I specified both values to be replaced.
parameters.xml:
<parameters>
<parameter name="HostUri" defaultValue="Replace me!">
<parameterEntry kind="XmlFile" scope="Web.config"
match="/configuration/appSettings/add[@key='HostUri']/@value" />
</parameter>
<parameter name="DbConn" defaultValue="Replace me!">
<parameterEntry kind="XmlFile" scope="Web.config"
match="/configuration/connectionStrings/add[@name='DbConn']/@connectionString" />
</parameter>
</parameters>
While the app setting HostUri
is correctly replaced, the connection string DbConn
stays untouched. I do not even get the default value set. It keeps its value DEFINE
as originally set in the Web.config.
My gut tells me my XPath /configuration/connectionStrings/add[@name='DbConn']/@connectionString
is incorrect, but it looks okay to me and follows what other posts have done, such as Cobus Bernard.
Any help is greatly appreciated.