asp.net - Error: XML transformation error in Azure Pipelines
问题描述
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.
https://tatvog.wordpress.com/2017/06/06/visual-studio-team-services-web-config-transform-error/
Edit: 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>
推荐阅读
- json - MongoDB - 嵌套数组与 group_by 的总和
- java - MeterRegistry IllegalArgumentException
- r - 我应该使用什么 ML 算法来确定鱼的成熟年龄?
- python - Numpy:从 JSON 文件加载数据会给出带有嵌套列表的 np 数组
- javascript - Passport.js 本地策略 + bcrypt + 散列密码存储在 dotenv 环境变量中 - 这是一种安全的方法吗?
- sql-server - 如何在 Visual Studio 2019 中将表和数据导入 SQL Server 数据库项目
- amazon-web-services - 用于高读取 IO/s 的 Elasticache 设置
- python - 导入 pywinauto 包时 Python 已停止工作,即使我没有使用它
- r - 如何将时间以分钟为单位:秒格式转换为秒?
- ios - 如何在 iOS 中为不同的导出方法和配置文件设置 fastlane?