在Azure DevOps管道中设置连接字符串 [英] Set connection string in Azure DevOps pipeline

查看:76
本文介绍了在Azure DevOps管道中设置连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些针对LocalDB的集成测试.

I have some integration tests that I'd like to run against LocalDB.

我的config.json文件具有以下部分...

My config.json file has the following section...

{
  "ConnectionStrings": {
    "DefaultConnection": ""
  }
}

是否可以在构建配置中设置此值?

Is it possible to set this value in the build config?

推荐答案

您可以通过多种方式实现此目的.类似于Powershell脚本来替换值和此替换令牌扩展

You can achieve this in several ways. Like Powershell scripts to replace the values and ofcourse this replace token extension

您应该像下面那样定义变量

You should define your variable like below

{
  "ConnectionStrings": {
    "DefaultConnection": "#{connectstring}#"
  }
}

在部署过程中,它将被替换为您的实际值.

During the deployment it will get replaced with your actual values.

有关详情,请参阅此SO

这篇关于在Azure DevOps管道中设置连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆