Does anybody know how to get the web.config transformation to replace a custom configuration section. I have set msbuild to verbose mode and the transformation simply ignores the existence of the custom section with a replace transform.
A Web. config transformation file contains XML markup that specifies how to change the Web. config file when it is deployed. You can specify different changes for specific build configurations and for specific publish profiles.
If you have a web application project, Right-click on web. config and choose Add Config Transform. This will add any config transforms that are missing from your project based on build configurations (i.e. if you have Production and Staging build configs, both will get a transform added).
XDT is a simple and straight forward method of transforming the web. config during publishing/packaging. Transformation actions are specified using XML attributes defined in the XML-Document-Transform namespace, that is mapped to the xdt prefix.
If you are using the extension Configuration Transform go to Build > Configuration Manager and find the Configuration dropdown for the project of which you want to change the app config. You can then select the edit and rename the build configurations for that project.
A web.config transformation does not care about custom configuration sections. It will do replacements on the whole web.config file.
Here is an example XML of a web.config replacement I used to set our memcached server ips:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<enyim.com>
<memcached>
<servers xdt:Transform="Replace">
<add address="192.168.130.1" port="11211" />
<add address="192.168.130.2" port="11211" />
<add address="192.168.130.3" port="11211" />
</servers>
</memcached>
</enyim.com>
</configuration>
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