Azure DevOps 管道 Json 变量替换 - Microsoft.Hosting.Lifetime

Azure DevOps Pipeline Json Variable Substitution - 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".

这些都不能定位名称中带有句点 (.) 的嵌套值吗?对吗?

Neither of these would be able to target a nested value with periods (.) in the name? Right?

抱歉,恐怕您暂时无法使用 JSON variable substitution 执行此操作。官方文档说明 JSON variable substitution 选项不支持名称中包含句点的变量。它在设计上不受支持,并且已在 Notes.

中记录

替代解决方法:

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

  2. 尝试使用 Replace Token task to change the value of Logging:LogLevel:Microsoft.Hosting.Lifetime. This task should work for your scenario. For more details you can check this issue

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