【发布时间】:2021-05-31 13:20:17
【问题描述】:
我们有一个带有以下 system.net mailSettings 属性的 Web.config 文件:
<system.net>
<mailSettings>
<smtp configSource="mailSettings.config" />
</mailSettings>
</system.net>
我们希望将网络配置中的这一行:<smtp configSource="mailSettings.config" /> 替换为一个值为 <smtp from="reports@companyxyz.com" deliveryMethod="Network"> <network enableSsl="true" host="smtp.sendgrid.net" port="587" userName="apiKey" password="12346576fgb" /> </smtp> 的管道变量。
另外,由于开发者不想更改 web 配置文件以适应替换令牌任务所需的前缀和后缀,我们希望使用自定义令牌前缀,例如:<mailSettings> 和后缀:</mailSettings>
steps:
- task: qetza.replacetokens.replacetokens-task.replacetokens@4
displayName: 'Replace tokens in **/*.config'
inputs:
tokenPattern: custom
tokenPrefix: '<mailSettings>'
tokenSuffix: '</mailSettings>'
以上可以实现吗? 我还要将此替换令牌任务放在 Azure App Deploy 任务之前吗?还是之后?
【问题讨论】:
-
您尝试过您的步骤吗?有效果吗?
标签: azure-devops azure-pipelines-release-pipeline