We're using msdeploy (or web deploy if you wish) to package and deploy web apps. By declaring parameters package time we can provide values at deploy time (to replace connection strings among other things).
The problem we currently face is replacing values in applicationSettings sections in our web config. We can't get msdeploy to replace the value because the content we want to replace is the text inside an xml element, not an attribute value (the warning we get is: "Cannot set a value on node type 'Element'").
The relevant config looks like this:
<applicationSettings> <Name.Of.Assembly.Properties.Settings> <setting name="someSetting" serializeAs="String"> <value>I wanna be replaced</value> </setting> </Name.Of.Assembly.Properties.Settings> </applicationSettings>
and the declare parameter xml looks like this:
<parameter name="XX" defaultValue="default"> <parameterEntry kind="XmlFile" scope="Web\.config$" match="/configuration/applicationSettings/Name.Of.Assembly.Properties.Settings/setting[@name='someSetting']/value" /> </parameter>
Does msdeploy only support replacing attribute values or am I doing something wrong?
The DeployOnBuild=true property essentially means "I want to execute an additional target when build completes successfully." The DeployTarget property identifies the name of the target you want to execute when the DeployOnBuild property is equal to true.
SetParameters. xml file. This provides a set of parameter values to the MSDeploy.exe command. You can update the values in this file and pass it to Web Deploy as a command-line parameter when you deploy your web package.
config file is located in the %SystemRoot%\Microsoft.NET\Framework\%VersionNumber%\CONFIG\ folder. The default settings that are contained in the Machine.
In Solution Explorer, right-click your Web site name, and then click Add New Item. In the Templates window, click Web Configuration File. The file name in the Name text box should be Web. config.
For posterity...
You just need to add "/text()" to the end of the match. That will change the value of enclosed by the tags. However, this value cannot be empty in the source web.config. So when you build the deployment package using the "Release" solution configuration, the web.Release.config must not set this value of the setting to an empty value.
<parameter name="XX" defaultValue="default"> <parameterEntry kind="XmlFile" scope="Web\.config$" match="/configuration/applicationSettings/Name.Of.Assembly.Properties.Settings/setting[@name='someSetting']/value/text()" /> </parameter>
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