首页 > 解决方案 > Azure DevOps Pipeline Json 变量替换 - Microsoft.Hosting.Lifetime

问题描述

如何使用 Azure DevOps 中的 Json 变量替换任务更改 Logging:LogLevel:Microsoft.Hosting.Lifetime 的值?

本文...

https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/transforms-variable-substitution?view=azure-devops&tabs=Classic

...状态:

If a variable name includes periods ("."), the transformation will attempt to locate the item within the hierarchy. For example, if the variable name is first.second.third, the transformation process will search for:

"first" : {
  "second": {
    "third" : "value"
  }
}

as well as "first.second.third" : "value".

这些都不能以名称中带有句点 (.) 的嵌套值为目标?正确的?

标签: jsonazure-devopsazure-pipelinesvariable-substitution

解决方案


这些都不能以名称中带有句点 (.) 的嵌套值为目标?正确的?

抱歉,恐怕你现在不能这样做JSON variable substitution。官方文档已经声明该JSON variable substitution选项不支持名称中包含句点的变量。它不受设计支持,并且已经记录在Notes中。

作为替代解决方法:

  1. 您可以用另一种格式定义变量名称,例如Logging:LogLevel:Microsoft_Hosting_Lifetime.

  2. 尝试使用Replace Token 任务来更改Logging:LogLevel:Microsoft.Hosting.Lifetime. 此任务应该适用于您的方案。有关更多详细信息,您可以查看此问题

  3. 您也可以在我们的UserVoice 网站JSON variable substitution上提交关于选项 的功能请求,这是我们产品建议的主要论坛。如果产品团队查看更新,他们将提供更新。感谢您帮助我们构建更好的 Azure DevOps。


推荐阅读