app.config连接字符串的文件转换任务 [英] File Transform task for app.config connectionstrings

查看:47
本文介绍了app.config连接字符串的文件转换任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设置了一个发布管道任务,以使用变量替换几个连接字符串值来转换我的app.config.这些属性不在节点中,而是在单独的节点中.文件转换"任务仅适用于节点中或文件中任何位置的设置吗?connectionstring属性上的属性是名称和"connectionString",例如

 < connectionStrings>< add name ="conn1"connectionString ="conn 1字符串"/></connectionStrings> 

我要在任务的值字段中输入什么?
像这样吗?
(a)connectionString ="conn 1更改的字符串"

(b)"conn 1更改字符串"

解决方案

首先,您需要创建一个Transform文件,例如:

转换文件:

有关如何处理翻译的详细信息,请参见

有关详细信息,请参阅此文档.

更新:

我们还可以使用File转换任务中的XML变量替换部分.然后在发布管道变量中定义所需的值以转换变量.

注意:变量替换仅对 applicationSettings appSettings connectionStrings 生效配置文件的configSections 元素.

有关详细信息,请参阅此 解决方案

First you need to create a Transform file, for example:

Transform file:

For details of how translations are processed, see File transforms and variable substitution reference.

To apply XML transformation to configuration files (*.config) you must specify a newline-separated list of transformation file rules using the syntax:

-transform <path to the transform file> -xml <path to the source file> -result <path to the result file>

For example:

For details , please refer to this document.

Update:

We can also use XML variable substitution part of File transform task. Then define the required values in release pipeline variables to transform the varibale.

Note : Variable substitution takes effect only on the applicationSettings, appSettings, connectionStrings, and configSections elements of configuration files.

For details , please refer to this document.

这篇关于app.config连接字符串的文件转换任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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