替换config.json文件的令牌在发行管道中不起作用

时间:2020-11-09 01:30:06

标签: tfs

我正在使用源代码管理TFS中的config.json的替换令牌,并在发布管道中使用替换令牌任务。

Config.json

{ “ ConnectionStrings”:“服务器= myServerAddress;数据库= myDataBase;用户ID = myUsername;密码= myPassword; Trusted_Connection = False; MultipleActiveResultSets = true;”

}

 Config.json

{ “ ConnectionStrings”:“#{constr}#”

}

使用变量: 名称值 构造服务器= myServerAddress;数据库= myDataBase;用户 Id = myUsername;密码= myPassword; Trusted_Connection = False; MultipleActiveResultSets = true;

替换令牌

我正在使用config.json

它不起作用,请纠正我。

1 个答案:

答案 0 :(得分:0)

替换config.json文件的令牌在发行管道中不起作用

要使用此任务,请确保以下几点:

  1. 设置正确的任务配置,例如Root directoryTarget files

    enter image description here

  2. 设置具有正确范围的正确变量:

    enter image description here

  3. 确保工件中的config.json可以通过私人代理进行测试,以检查config.json中是否存在$(System.DefaultWorkingDirectory)

作为测试结果(我已与我的私人代理检查过):

enter image description here

注意:要检查结果,我们需要检查发布管道中的$(System.DefaultWorkingDirectory)而不是仓库中的config.json