asp.net-core - 在 Azure DevOps 管道中设置连接字符串

标签 asp.net-core azure-devops

我有一些我想针对 LocalDB 运行的集成测试。

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

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

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

最佳答案

您可以通过多种方式实现这一目标。像 Powershell 脚本一样替换值,当然 this replace token extension


你应该像下面这样定义你的变量

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

在部署期间,它将被您的实际值替换。

Refer this SO for more details

关于asp.net-core - 在 Azure DevOps 管道中设置连接字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53637328/

相关文章:

c# - ASP.NET Core 3 : Cannot resolve scoped service 'Microsoft.AspNetCore.Identity.UserManager` 1[Alpha. Models.Identity.User]' 来自根提供商

asp.net-core - 未找到 IEndpointRouteBuilder 接口(interface)

python - 在Python中的azure函数的帮助下,Json从devops到存储帐户都表现出色

c# - 如何为我的 Azure 应用程序创建应用程序 token ?

git - 从visual studio online转移到github

visual-studio - 限制代码分析抑制?

c# - ASP.NET 核心 : middleware to controller conversion issue?

c# - 我需要在 ASP .Net Core 3.1 Web API 启动时执行异步方法

resharper - ReSharper 9.2 是否支持 ASP.NET 5 TagHelpers 的智能感知

ASP.NET Core 2 + Angular -> 如何设置 VSTS?