You can specify the values manually or use value presets for replacement, which can be edited if needed.
| Template (optional):|
File Content Replacer provides a template for every attribute to be replaced. Clicking the Load Template... button displays the combobox with templates containing value presets for replacement. The templates can be filtered by language (e.g.
C#), file (e.g.
AssemblyInfo) or attribute (e.g.
AssemblyVersion) by typing in the combobox. When a template is selected, the settings are automatically filled with predefined values. See the section below for template details.
Click Edit file list and specify paths to files where the values to be replaced will be searched. Provide a newline- or comma-separated set of rules in the form of +|-:[path relative to the checkout directory] .
Ant-like wildcards are supported, e.g. dir/**/*.cs.
If a pre-defined template is selected, the files associated with that template will be used.
By default, TeamCity will auto-detect the file encoding. To specify the encoding explicitly, select it from the drop-down. When specifying a custom encoding, make sure it is supported by the agent.
If a pre-defined template is selected, the file encoding associated with that template will be used.
Specify a pattern to search for, in the regular expression format. MULTILINE mode is on by default.
If a pre-defined template is selected, the pattern associated with that template will be used.
By default, the comparison is case-sensitive. Uncheck for case-insensitive languages.
If a pre-defined template is selected, the comparison associated with that template will be used.
Since TeamCity 2017.1 The box is checked by default and applies to both the search and replacement strings. Uncheck to use fixed strings.
If you use versioned settings (XML or Kotlin DSL), in addition to the default
REGEX and non-default
FIXED_STRINGS mode, the
REGEX_MIXED mode is available. In this mode, the search pattern is interpreted as a regular expression, but the replacement text will be quoted (the
$ characters have no special meaning).
See a sample File Content Replacer configuration for settings in Kotlin:
fileRules = "**/*"
pattern = "(?iu)the\h+pattern\h+to\h+search\h+for"
regexMode = FileContentReplacer.RegexMode.REGEX_MIXED
replacement = """%teamcity.agent.work.dir%\nd_r\bin\isf"""
Type the text to be used for replacing the characters in the Find what box. To delete the characters in the Find what box from your file, leave this box blank.
$N sequence references N-th capturing group. All backslashes (\) and dollar signs ($) without a special meaning should be quoted (as \\ and \$, respectively).