File Transform task for app.config connectionstrings

随声附和 提交于 2021-01-29 06:52:32

问题


Im setting up a release pipeline task to transform my app.config using variables to replace several connectionstring values. These properties are not in the node, but rather in a seperate node. Does the File Transform task work only with settings in the node or anywhere in the file? The attribute on the connectionstring properties are name and "connectionString", eg.

<connectionStrings>
   <add name="conn1" connectionString="conn 1 string"/>
</connectionStrings>

What do I put in the value field of task?
Something like this?
(a) connectionString="conn 1 changed string"
or
(b) "conn 1 changed string"


回答1:


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.



来源:https://stackoverflow.com/questions/63796643/file-transform-task-for-app-config-connectionstrings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!