Failed Deploy XML Transform

Hi,
We have been using Octopus for the past several months for both our web apps and windows services without issue. However this past Friday we ran into a problem that we have not been able to figure out. The deployment failed during the XMLTransformation process:

2014-02-22 02:17:21 WARN [XML Transformation] WARNING: LineNumber: 34, LinePosition: 22, Message: Argument ‘debug’ did not match any attributes
2014-02-22 02:17:21 ERROR [XML Transformation] System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Web.Publishing.Tasks.XmlTransformationLogger.LogWarning(XmlNode referenceNode, String message, Object[] messageArgs)

at Microsoft.Web.Publishing.Tasks.RemoveAttributes.Apply()
at Microsoft.Web.Publishing.Tasks.Transform.ApplyOnAllTargetNodes()
2014-02-22 02:17:21 DEBUG [XML Transformation] Done executing RemoveAttributes

2014-02-22 02:17:21 ERROR Octopus.Shared.Activities.ActivityFailedException: One or more errors were encountered when applying the XML configuration transformation file: C:\Octopus\Applications\dev.com\ourapp\1.2.5_1\Web.Staging.config. View the deployment log for more details, or set the special variable OctopusIgnoreConfigTransformationErrors to True to ignore this error.

The other strange thing we noticed was that, for some reason, Octopus was first processed the release.config transform, then our staging.config.

2014-02-22 02:17:21 DEBUG [XML Transformation] Source file:
‘C:\Octopus\Applications\dev.com\ourapp\1.2.5_1\Web.config’.
2014-02-22 02:17:21 DEBUG [XML Transformation] Transform file:
‘C:\Octopus\Applications\dev.com\ourapp\1.2.5_1\Web.Release.config’.

2014-02-22 02:17:21 DEBUG [XML Transformation] Source file:
‘C:\Octopus\Applications\dev.com\ourapp\1.2.5_1\Web.config’.
2014-02-22 02:17:21 DEBUG [XML Transformation] Transform file:
‘C:\Octopus\Applications\dev.com\ourapp\1.2.5_1\Web.Staging.config’.

If I had to guess, the error is being caused by the two transformations being run. However that leads to the question why would Octopus be running both transforms (especially since it has never done this before)?
Any ideas or help is greatly appreciated.
Thanks!

Hi Scott,

Octopus always runs a *.Release.config if it is found (“Release” is assumed to mean “when I deploy this to something that is not my developer workstation”). It then runs *..config if found.

Have you just added an environment named “Release”? If so, you might want to consider calling it something different, like “Production”.

Hope that helps,
Paul

My colleague helped me with this.

We removed

xdt:Transform="RemoveAttributes(debug)

from

<system.web>

<!–
In the example below, the “Replace” transform will replace the entire
section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the “xdt:Locator” attribute.

  <customErrors defaultRedirect="GenericError.htm"
    mode="RemoteOnly" xdt:Transform="Replace">
    <error statusCode="500" redirect="InternalError.htm"/>
  </customErrors>
-->

</system.web>

…And it worked perfect!