升级FileTransform@2后执行JSON转换报错:非Windows平台无法执行XML转换
解决FileTransform@2非Windows平台JSON转换报错问题
问题原因
FileTransform@2默认启用XML转换功能(enableXmlTransform参数默认值为true),即便你指定了fileType: json,任务仍会尝试初始化XML转换相关逻辑。而非Windows平台(Linux/macOS)不支持XML转换的依赖组件,因此触发「Cannot perform XML transformations on a non-Windows platform」错误。
解决方案
显式添加enableXmlTransform: false参数,禁用XML转换功能,只保留JSON转换逻辑即可:
- task: FileTransform@2 displayName: 'Update the parameters in azuredeploy.web.parameters.json' inputs: folderPath: '**/' targetFiles: '**/azuredeploy.web.parameters.json' fileType: json enableXmlTransform: false # 禁用XML转换,适配非Windows平台
补充说明
如果使用Windows代理,这个问题不会出现,但为了配置的通用性,建议始终显式设置该参数,避免切换代理环境时再次触发错误。
内容的提问来源于stack exchange,提问作者user26955403
相关产品推荐
相关产品推荐

