Search code examples
asp.netweb-configtransformweb-config-transform

Web.Config transforms with new line symbol


I use .settings file in my application and I need to override settings in web.config file sometimes.

So here is an example of setting overridden by web.config:

    <applicationSettings>
        <ADM.Web.Admin.ADMSettings>
            <setting name="ApplicationWebAddress" serializeAs="String">
                <value>http://localhost:8929</value>
            </setting>
        </ADM.Web.Admin.ADMSettings>
    </applicationSettings>

And I need to change this setting depending on if I publish to Dev or Live site So I discribe Web.Debug.config like this:

        <setting name="ApplicationWebAddress" serializeAs="String" xdt:Transform="Replace" xdt:Locator="Match(name)">
            <value>http://dev.site.com</value>
        </setting>

and Web.Release.config:

        <setting name="ApplicationWebAddress" serializeAs="String" xdt:Transform="Replace" xdt:Locator="Match(name)">
            <value>http://live.site.com</value>
        </setting>

After publishing I found the following in Web.Config File:

        <setting name="ApplicationWebAddress" serializeAs="String">
            <value>http://live.site.com
            </value>
        </setting>

As u can see there is a new line before . My question is Why there is "new line" and what to do to change one setting value to another one?


Solution

  • Did you try installing VS2010 SP1?

    Check this: Web.config transform writes extra line break/spaces to values elements under applicationSettings section