Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File Transform task for app.config connectionstrings

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"

like image 266
bitshift Avatar asked Apr 20 '26 15:04

bitshift


1 Answers

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

enter image description here

Transform file: enter image description here

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: enter image description here

enter image description here

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.

like image 183
Hugh Lin Avatar answered Apr 23 '26 09:04

Hugh Lin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!