I’ve spent the day trying to get to the bottom of an XML transformation error in Azure DevOps and I can’t seem to get a handle on the problem. Locally the config transform works fine and the config transforms for the other environments that I’m deploying to are working in Azure DevOps.
The error that appears in the logs when the IIS Web App Deployment task is terminated is:
2021-02-26T15:29:49.9263250Z ##[error]Error: XML transformation error while transforming C:\...\Web.config using C:\...\Web.Live.config.
Obviously I’ve cut out the long file paths that Azure DevOps applies.
Further up in the IIS Web App Deployment task logs the following error appears but is not highlighted as being significant. Aster this error is logged it does appear to apply transforms, before giving the aforementioned error which terminates the process:
2021-02-26T15:29:49.9178971Z System.NullReferenceException: Object reference not set to an instance of an object. 2021-02-26T15:29:49.9180071Z at Microsoft.Web.XmlTransform.XmlTransformationLogger.ConvertUriToFileName(XmlDocument xmlDocument) 2021-02-26T15:29:49.9180525Z at Microsoft.Web.XmlTransform.XmlTransformationLogger.LogWarning(XmlNode referenceNode, String message, Object messageArgs) 2021-02-26T15:29:49.9180911Z at Microsoft.Web.XmlTransform.Transform.ApplyOnAllTargetNodes()
I’ve been through the XML file and can’t find any malformed XML, I’ve also run it through an XML validator. I’ve previewed the transform locally in Visual Studio 2019 Professional (possible using Slow Cheetah) and it’s fine there too.
Can anyone give a pointer as to what might cause this transformation error in the pipelines?
I found my answer, it was posted online on a blog by this top lad or lady.
In case the link goes dead, the solution was as below.
I tracked that the culprit was the following transform:
<system.web> <compilation xdt:Transform="RemoveAttributes(debug)" /> </system.web>
I got it to work by changing the transform to this:
<system.web> <compilation targetFramework="4.5" xdt:Transform="Replace"> </compilation> </system.web>
Answered By – Carpentweet
Answer Checked By – Jay B. (BugsFixing Admin)