Xml transform issues a warning and is escalated to an error by octopus?

I have xml tranformations on a deploy step. The transformation has a conditional transformation using a Condition which changes the name of an element if it has an old name.

<add name="Database" xdt:Locator="Condition(@name='OldDatabase')" xdt:Transform="SetAttributes(name)" />

This works well if the old name is present, but if not, the transformation issues a warning.

Warning
File …web.config.install.xdt, line 16, position 6:
No element in the source document matches ‘/configuration/connectionStrings/add[@name=‘OldDatabase’]’

This is ok but the strange thing is that when all other transformations for the file has been processed, this warning is elevated to an error.

Error
The XML configuration file …web.config failed with transformation file …web.config.install.xdt.
Could not transform the file ‘…web.config’ using the pattern ‘…web.config.install.xdt’.
…web.config.install.xdt(16,6): No element in the source document matches ‘/configuration/connectionStrings/add[@name=‘OldDatabase’]’
Running rollback conventions…

Why is it behaving like this? Why elevate a warning? Is there some way to not elevate warnings to errors?
I read that I could supress errors by setting the Octopus.Action.Package.IgnoreConfigTransformationErrors variable to true but I would like to fail on errors, but not on warnings…
Using Octopus 3.7.7
/Dan

Hi Dan,

Thanks for getting in touch.

I am trying to get to the bottom of why we started treating config transform warnings as errors. In this case is does seem harsh and I agree that it would be nice to continue to fail on errors but treat warnings as warnings.

Are you applying that transform to many files and some of them don’t have the old name present?

Cheers
Shane

The transformation file is part of an installation package that is designed to work for installation and upgrade, regardless of the source version. So it is performed on every installation/upgrade.
For the time being, the targets that we deploy to using octopus haven’t the old name present but I would like to avoid to use separate installation scripts depending on source version.

I can live with a setting that allows me to ignore warnings but I really would like the errors :wink:

/Dan

Hi Dan,

I’ve started an issue here to allow you to treat warnings as warnings and error as errors:

I’ll add a special variable that enables you to turn off the default “fail on warning”.

Cheers,
Shane