开发者

Web.config Transforms add extra line returns where there are none

When my Web.config transforms it is adding a new line before the end value tag in my ApplicationSettings. This new line is showing up in the setting and causing an exception. Example:

Web.config:

        <setting name="FilePath" serializeAs="String">
            <value>c:\path</value>
        </setting>

Web.Debug.config:

        <setting name="FilePath" se开发者_开发问答rializeAs="String" xdt:Transform="Replace" xdt:Locator="Match(name)">
            <value>c:\path</value>
        </setting>

Published Web.config:

        <setting name="FilePath" serializeAs="String">
            <value>c:\path
            </value>
        </setting>

The end value tag being on its own line is causing problems. Does anyone know how to get it to stop doing this? Thanks.


This is a known problem, which is fixed in VS 2010 SP1, apparently.

http://connect.microsoft.com/VisualStudio/feedback/details/544183/web-config-transform-writes-extra-line-break-spaces-to-values-elements-under-applicationsettings-section#


No idea, but you could trim the string before you use it in the application...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜