如何在版本中替换app.config文件中的值? 我想用我的版本中的变量替换间隔的值。 这是我的app.config:

问题描述 投票:0回答:1
app.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="Interval" value="15000" />
    </appSettings>
</configuration>

我使用

Azure App Service Deploy

任务来部署.NET核心Web作业:

我拥有的所有选项是:

enter image description here

我如何使用发行版本的变量来替换我的

app.config

中的值?

thanks to @levi lu-msft for theInsightenter image description here。在Azure DevOps中,释放管道转到pipeline>变量

添加一个名称

Interval

和值
30000

.
.net azure azure-devops azure-web-app-service azure-pipelines-release-pipeline
1个回答
-1
投票

在Azure App Service部署任务转到File Transforms&Villiable替换选项

部分。检查
XML变量替换
复选框。

检查

app.configenter image description here文件是部署软件包的一部分,并位于正确的文件夹中。

    XML变量替换
  • 功能将在<add key="Interval" value="15000" />文件中寻找app.config。 基于管道变量,它将用value="15000"代替
  • value="30000"

部署后,转换后的
app.config

文件将看起来像这样:
  • <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="Interval" value="30000" /> </appSettings> </configuration>
    
    
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.