Web.Config transformation of custom config section
Asked Answered
G

2

14

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.

Goodrum answered 29/1, 2011 at 10:41 Comment(2)
Can you paste the snippet showing your custom config section here????Hourihan
@Sayed Ibrahim Hashimi - I think the issue was an incorrect configuration switch being passed by TeamCity due to it caching environment variables. Thanks for you interest:)Goodrum
P
15

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>
Proliferous answered 3/2, 2011 at 17:19 Comment(1)
yeah it must have been a teamcity issue passing an incorrect configuration, thanksGoodrum
P
0

In case you have the same issue I was having... I wanted to kick myself!

During Publish, make sure you select the environment :)

enter image description here

Psephology answered 17/8, 2015 at 22:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.