json - 替换令牌任务不适用于我的 .json 文件
问题描述
下面是我的 .net 核心项目的 appsettings.json 文件的内容。我在我的发布管道中使用替换令牌任务。我正在尝试替换 appsettings.json 文件中的变量 IrtMfdDb 的值,并将输出保存为appsettings2.json。所以我创建了一个变量组,其中包含一个名为ConnectionStrings.IrtMfdDb的变量,使用 json 路径并保持大小写相同。
当我运行该版本时,它似乎确实找到了我的 appsettings.json 文件,但是它不会替换令牌ConnectionStrings.IrtMfdDb。查看说明,它仅声明使用 json 路径作为变量名声明变量,并且设置的任何值都将被替换为新值。这不起作用,所以我显然遗漏了一些东西。有人可以解释我可能做错了什么吗?
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"ConnectionStrings": {
"GlobalMaster": "Data Source=MySQL001;Initial Catalog=GLOBALMASTER;Integrated Security=True;Application Name=My.API.Infrastructure",
"MasterDb": "Server=MySQL001;Initial Catalog=GlobalMaster;Trusted_Connection=True;",
"IrtMfdDb": "Server=MySQL001;Initial Catalog=MyCatalog;Trusted_Connection=True;"
}
}
解决方案
推荐阅读
- javascript - 如何在 n:m 关联中进行单向限制?
- matlab - 如何使用批处理文件打开已打开的 MATLAB 文件?
- ubuntu - 在 Ubuntu 上,如何将 ~/.dotnet/tools 添加到 PATH 变量中?它不在 /etc/environment 或 ~/.bashrc 中,但它仍然在我的 PATH 中
- raku - 哈希中的接受与智能匹配:有什么区别?
- r - knitr opts_knit$set(root.dir = "../") 当 chunk_output_type: 控制台被忽略
- .net - System.Speech.Synthesis 的事件信息中的流编号在哪里?
- java - 如何在 API 28 中设置 android 日期和时间选择器的样式
- jboss - 使用不同于 UPN 或 samAccountName 的用户名进行身份验证
- azure - CLI 是否针对吞吐量进行了优化?
- tensorflow - tensorflow.python.framework.errors_impl.ResourceExhaustedError