I'm using an XML-Document-Transform to transform my web.config file for deployment to a staging server. Unfortunately it isn't transforming exactly as specified and is adding some whitespace to an element's text. This whitespace is then being picked up by the Castle Windsor configuration that I use and bombing the application.
Here's an example:
web.config:
<configuration>
<castle>
<properties>
<serverUrl>http://test</serverUrl>
<properties>
<components>
<component id="MyService">
<parameters>
<Url>#{serverUrl}/MyService.asmx</Url>
</parameters>
</component>
</components>
<castle>
<configuration>
web.staging.config:
<configuration>
<castle>
<properties>
<serverUrl xdt:Transform="Replace">http://staging</serverUrl>
<properties>
<castle>
<configuration>
Output web.config:
<configuration>
<castle>
<properties>
<serverUrl>http://staging
</serverUrl>
<properties>
<components>
<component id="MyService">
<parameters>
<Url>#{serverUrl}/MyService.asmx</Url>
</parameters>
</component>
</components>
<castle>
<configuration>
As you can see additional whitespace has been inserted in to the serverUrl
element by the transformation.
Unfortunately Castle includes the whitespace when inserting the serverUrl
into the Url
of the service which creates an invalid URL.
Anyone else come across this? Anyone got a solution that still uses the new Microsoft transformation method but doesn't cause additional whitespace to be inserted?
IMHO this is a bug in the transform process although Castle should probably be ignoring the whitespace too.
Many thanks, Rob
This is fixed in Visual Studio 2010 SP1 and is an issue with Microsoft.Web.Publishing.Tasks.dll and related *.target files. If you are using a build server that does not have Visual Studio SP1 installed but is using MsBuild then you should ensure that you copy these files.
To resolve this issue copy everything from a machine with SP1 installed from C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web to the same directory on the build server.